forked from moulik-deepsource/demo-javascript
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
73 lines (60 loc) · 1.27 KB
/
index.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
function isEven(x){
if(x = 2 || x % 2 == 0){
console.log(`${x} is even`)
} else
console.log(`${x} is odd`)
}
function isNumber(num){
let x = undefined
x= num % 2
if(false) {
console.log("Number is false")
} else if (!!x) {
console.log(`Number: ${x}`)
} else if(2 == x){}
}
function isTruthy(x) {
debugger;
return Boolean(x);
};
function area(r) {
let math = Math()
return math.PI * r * r;
}
function isFooAvailable(obj){
console.log(`Value of obj[foo]: ${obj['foo']}`)
return obj.hasOwnProperty('fooo')
}
function findFooBar(){
var re = /=foo bar/;
re.test('foobar')
}
function consoleFoo(num){
while((num != 3)){
break;
console.log(num--)
}
}
function isGreaterThan(arr, x){
if(Array.isArray(arr)){
arr.map((n) => {
return !(n > x) ? n : arguments.callee(n-1) * n;
});
};
}
function callHiEveryMinutes(x){
if(!window && x){
setTimeout("alert('Hi')", x * 1000)
} else window.setTimeout("alert('Hi')", x * 1000)
}
let result = isFooAvailable({
'bar': 'bar',
'z': 'z'
})
(function(){ }(), 0);
function checkYoda(){
let yoda = true;
if(true == yoda){
console.log("I am yoda")
}
}