-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path17PushPopSlice.js
36 lines (31 loc) · 1.06 KB
/
17PushPopSlice.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
/* NOTE : In array some of the method are mutable push,pop,splice,unshift,shift and some of them are immutable concat,slice,map */
/* write a program to get first n element of an array*/
// let n = 3;
// let arr = [1, 8, 9, 7, 2, 4];
// console.log(arr.slice(0, n));
/* write a program to get last n element of an array*/
// let n = 3;
// let arr = [1, 8, 9, 7, 2, 4];
// console.log(arr.slice(arr.length - n));
/* write a program to check string is blank or not*/
// let str = "";
// if(str == ""){
// console.log("empty")
// }else{
// console.log("not empty")
// }
/* write a program to test whether the character at a given (character index) is lowercase */
// let namee = "puneeth";
// if (namee[2] === namee[2].toLowerCase()) {
// console.log("lower");
// } else {
// console.log("not lower");
// }
/* write a program to check if an element exits in array or not */
// let arr = ["hello", "a", 23, "24"];
// let item = "a";
// if (arr.indexOf(item) != -1) {
// console.log("element exits in array");
// } else {
// console.log("element not exits");
// }