-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathjava loops.js
More file actions
68 lines (45 loc) · 923 Bytes
/
Copy pathjava loops.js
File metadata and controls
68 lines (45 loc) · 923 Bytes
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
var i =0;
while (i<5){
console.log(i);
i++;
}
//do while
var i = 1;
do{
console.log(i);
i++;
}while(i<5);
//break and continue
for (i = 0 ; i<5;i++){
if(i===3) continue;
console.log(i);
}
// declarin afunction and using a return statement
function user(name){
return name + " is good";
}
const name = user("sujay");
console.log(name);
//recursive function
var num = 1;
function recursive(){
console.log(num);
num++;
if(num < 10) {
recursive();
} else return;
}
recursive();
var array = [1,3,4,5,5,2,3,4,5]
array.sort()
console.log (array)
// objact methods
var object ={
name:"sujay",
age:12};
console.log(Object.keys(object));
console.log(Object.values(object));
console.log(Object.entries(object));
object.freeze(object);
object.name ="sujay"
object.freeze(object);