Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homework№5.OR-Media.Pre-front #11

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Homework№5.OR-Media.Pre-front #11

wants to merge 5 commits into from

Conversation

Slavik1999
Copy link
Owner

No description provided.

@Slavik1999 Slavik1999 requested a review from RudikAleksandr May 24, 2019 19:46
var Name = prompt('Введите ваше имя');
var reg = /\d/g;
if (Name.match(reg) === null) {
function reverse(Name) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нет смысла написание функции в if, она все равно поднимается вверх, и написание такого функций в if плохая практика

@@ -0,0 +1,14 @@
var Name = prompt('Введите ваше имя');
var reg = /\d/g;
if (Name.match(reg) === null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

проверять на null не нужно это и так false будет значение. можно переписать как !Name.match(reg)

<button class="ButtonLink" type="submit">LINK</button>
<button class="ButtonStyle" type="submit">STYLE</button>
<button class="ButtonMaket" type="submit">MAKET</button>
<script src="./js/index.js"></script>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

подключение скриптов делается в конце body

@@ -0,0 +1,36 @@
document.getElementsByClassName("ButtonLink")[0].onclick = function () { window.open("https://vk.com/white_power69", "_blank") }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше использовать addEventListener

@@ -0,0 +1,36 @@
document.getElementsByClassName("ButtonLink")[0].onclick = function () { window.open("https://vk.com/white_power69", "_blank") }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

такого рода строки (https://vk.com/white_power69) лучше выносить в константные переменные, а еще лучше создать файл на подобии config.js или config.json и туда перенести такие переменные в объект, так как такая строка может много где использоваться в проекте, и что бы везде ее не менять при необходимости была возможность сделать это в одном месте

Cont.remove();
var el = document.querySelector("Link");
el.href = "./css/ThirdStyle.css";
var Body = document.body;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

повторяющийся код можно вынести в функцию. Отличаться будут только параметры.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants