-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpractice.js
43 lines (35 loc) · 862 Bytes
/
practice.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function sum() {
const a = Number.parseInt(prompt("Give a number!"), 10);
const b = Number.parseInt(prompt("Give another number!", 10))
return console.log (a + b);
}
sum();
function multiply () {
return console.log (a * b);
}
multiply ();
function getCharCount() {
let names = String(prompt("What are your names?"));
return console.log(names.length);
}
getCharCount();
function shoutMyName() {
return console.log(names.toUpperCase());
}
shoutMyName();
function lowerName() {
return console.log(names.toLowerCase());
}
lowerName();
function getFirstCharacter() {
return console.log(names[0]);
}
getFirstCharacter();
function getLastCharacter() {
return console.log(names[names.length - 1]);
}
getLastCharacter();
function skipFirstCharacter() {
return console.log(names.substring(1));
}
skipFirstCharacter();