-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
Conversation
var Name = prompt('Введите ваше имя'); | ||
var reg = /\d/g; | ||
if (Name.match(reg) === null) { | ||
function reverse(Name) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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") } |
There was a problem hiding this comment.
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") } |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
повторяющийся код можно вынести в функцию. Отличаться будут только параметры.
No description provided.