-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPractice.js
57 lines (43 loc) · 1.5 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
var elm = prompt("Enter No. of Element");
let num1 = [56, 78, 67, 15, 90, 98, 101, 546, 678, 987, 876, 765,898, 1101, 465, 999, 345, 267, 167, 34];
// let num1 =['Shaheer', 'Muzammil', 'Talib', 'Jabbar', 'Zulqarnain', 'Zohaib', 'Sattar', 'Jibran', 'Asad', 'Adeel', 'Zain' , 'Wadood', 'Noman', 'Farman', 'Fahad', 'Majid', 'Waqas', 'Jalal','Nadeem','Fahim'];
for(var i =0 ; i<= num1.length; i++){
// console.log('-');
if(elm==num1[i]) {
console.log(num1[i],'found');
alert('This number is found at'+ " " + i);
break;
}
else {
if(num1.length== i){
console.log('not found');
alert('This number not found!');
}
// break;
}
}
// alert('This number not found!' );
// var fruits_arr = ['Apple','Mango','Grapes','Orange','Fig','Cherry'];
// function checkValue(value,arr){
// var status = 'Not exist';
// for(var i=0; i<arr.length; i++){
// var name = arr[i];
// if(name == value){
// status = 'Exist';
// break;
// }
// }
// return status;
// }
// console.log('status : ' + checkValue('Mango', fruits_arr) );
// console.log('status : ' + checkValue('Peach', fruits_arr) );
// let cup = {
// colour : 'green',
// shape : 'Round',
// }
// console.log('cup',cup);
// let Ball = {
// colour : 'Yellow',
// shape : 'Round',
// }
// console.log ('Ball', Ball);