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

Нужно больше функций #3

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions index.html
Expand Up @@ -10,6 +10,7 @@
</head>

<body>
<script src="./js/main.js"></script>;
<main>

<!-- Фильтрация изображений от других пользователей -->
Expand Down
19 changes: 12 additions & 7 deletions js/main.js
@@ -1,7 +1,12 @@
function getSum(a,b){
const text = 'Сумма чисел равна:';
const sum = a + b;
const del = a/b;
return `${text } ${ sum}`;
}
getSum(1,2);
const randomNumber = (min, max) => {
if(min < 0 || max < 0){
return 0;
}
const arrayNumbers = [min, max];
if(min >= max){
min = arrayNumbers[1];
Copy link
Collaborator

Choose a reason for hiding this comment

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

лучше использовать деструктуризацию:
[min, max] = [max, min];

max = arrayNumbers[0];
}
return Math.floor(Math.random() * (max - min + 1)) + min;
};
const lenghtChecked = (text , maxLenght) =>(String(text).length <= maxLenght);