-
Notifications
You must be signed in to change notification settings - Fork 0
Add files via upload #5
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
Open
codebasecodebase
wants to merge
1
commit into
master
Choose a base branch
from
js2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>1</title> | ||
</head> | ||
<body> | ||
|
||
<script type="text/javascript"> | ||
|
||
var s=prompt("Введите строку");// переменная для ввода строки | ||
|
||
|
||
function glasnie (s) { | ||
var sa=s.toLowerCase().split(''); // превращает строку в массив из символов | ||
var vs="eyuioaEYUIOA";// строка с гласными | ||
|
||
var r = sa.reduce( (sum, val) => { | ||
if (vs.indexOf (val) !==-1) { | ||
sum++; // добавляем в кол-во найденных гласных +1 | ||
} | ||
return sum; // Возвращаем новую сумму (или старую, если гласных нет). | ||
}, 0); // Запускаем reduce с нулевой суммой | ||
return r; | ||
} | ||
var rezault=glasnie(s) ;// присваивание переменной значения функции | ||
alert ("Количество гласных: "+rezault); | ||
|
||
function soglasnie (s) { | ||
var sa=s.toLowerCase().split(''); // превращает строку в массив из символов | ||
var vs="qrtpsdfghjklzxcvbnmQRTPSDFGHJKLZXCVBNM";// строка с гласными | ||
|
||
var r = sa.reduce( (sum, val) => { | ||
if (vs.indexOf (val) !==-1) { | ||
sum++; // добавляем в кол-во найденных гласных +1 | ||
} | ||
return sum; // Возвращаем новую сумму (или старую, если гласных нет). | ||
}, 0); // Запускаем reduce с нулевой суммой | ||
return r; | ||
} | ||
var rezault=soglasnie(s) ;// присваивание переменной значения функции | ||
alert ("Количество согласных: "+rezault); | ||
|
||
function specsimvoli (s) { | ||
var sa=s.toLowerCase().split(''); // превращает строку в массив из символов | ||
var vs="!@#$%^&*(){}:<>?'";// строка с гласными | ||
|
||
var r = sa.reduce( (sum, val) => { | ||
if (vs.indexOf (val) !==-1) { | ||
sum++; // добавляем в кол-во найденных гласных +1 | ||
} | ||
return sum; // Возвращаем новую сумму (или старую, если гласных нет). | ||
}, 0); // Запускаем reduce с нулевой суммой | ||
return r; | ||
} | ||
var rezault=specsimvoli(s) ;// присваивание переменной значения функции | ||
alert ("Количество Спец символов: "+rezault); | ||
|
||
function probeli (s) { | ||
var sa=s.toLowerCase().split(''); // превращает строку в массив из символов | ||
var vs=" ";// строка с гласными | ||
|
||
var r = sa.reduce( (sum, val) => { | ||
if (vs.indexOf (val) !==-1) { | ||
sum++; // добавляем в кол-во найденных гласных +1 | ||
} | ||
return sum; // Возвращаем новую сумму (или старую, если гласных нет). | ||
}, 0); // Запускаем reduce с нулевой суммой | ||
return r; | ||
} | ||
var rezault=probeli(s) ;// присваивание переменной значения функции | ||
alert ("Количество пробелов: "+rezault); | ||
|
||
function cifri (s) { | ||
var sa=s.toLowerCase().split(''); // превращает строку в массив из символов | ||
var vs="1234567890";// строка с гласными | ||
|
||
var r = sa.reduce( (sum, val) => { | ||
if (vs.indexOf (val) !==-1) { | ||
sum++; // добавляем в кол-во найденных гласных +1 | ||
} | ||
return sum; // Возвращаем новую сумму (или старую, если гласных нет). | ||
}, 0); // Запускаем reduce с нулевой суммой | ||
return r; | ||
} | ||
var rezault=cifri(s) ;// присваивание переменной значения функции | ||
alert ("Количество цифр: "+rezault); | ||
|
||
alert("Всего символов:" + s.length); | ||
|
||
</script> | ||
|
||
</body> | ||
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>2</title> | ||
</head> | ||
<body> | ||
|
||
<script type="text/javascript"> | ||
|
||
//var s=prompt("Введите строку");// переменная для ввода строки | ||
|
||
var n=prompt("введите число"); | ||
n=parseInt(n); | ||
if ((n%2==0)&&(n!=2)) // любое четное число - составное | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Расставляйте пробелы в коде |
||
alert("Составное число"); | ||
else if (n==2)//число 2 простое | ||
alert("Простое число"); | ||
else{ // число нечетное | ||
k=Math.round(Math.sqrt(n)); | ||
flag = false; | ||
|
||
for(i=2; i<k+1; i++) | ||
if(n%i==0) | ||
{ | ||
alert("Составное число"); | ||
flag = true; | ||
break; | ||
} | ||
|
||
if (flag == false) | ||
alert("Простое число"); | ||
} | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>2</title> | ||
</head> | ||
<body> | ||
|
||
<script type="text/javascript"> | ||
|
||
//var s=prompt("Введите строку");// переменная для ввода строки | ||
|
||
var n=prompt("введите число Фибоначчи"); | ||
|
||
function fib(n) { | ||
let a = 1; | ||
let b = 1; | ||
for (let i = 3; i <= n; i++) { | ||
let c = a + b; | ||
a = b; | ||
b = c; | ||
} | ||
return b; | ||
} | ||
|
||
alert( fib(n) ); | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>7</title> | ||
</head> | ||
<body> | ||
|
||
<script type="text/javascript"> | ||
|
||
//var s=prompt("Введите строку");// переменная для ввода строки | ||
|
||
var N=prompt("введите число секунд не более 86399"); | ||
|
||
var s1 = (((N % 60) / 10) % 6) * 10; | ||
var m1 = ((N / 600) % 6) * 10; | ||
var m2 = Math.trunc(m1); | ||
var h = (N / 3600) % 24; | ||
var h1 = Math.trunc(h); | ||
|
||
if( N > 86399 ){ | ||
alert("Недопустимая величина"); | ||
} | ||
|
||
alert(h1 + ':' + m2 + ':' + s1); | ||
|
||
//alert(m); | ||
//alert(s); | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>8</title> | ||
</head> | ||
<body> | ||
|
||
<script type="text/javascript"> | ||
var n=prompt("введите 3 словосочетания:"); | ||
|
||
var acronym = n.split(' ').map(function(item){return item[0]}).join(''); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. можно стрелочную функцию |
||
alert(acronym); | ||
|
||
|
||
|
||
|
||
</script> | ||
|
||
</body> | ||
</html> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Можно использовать
vs.includes(val))