-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
53 lines (44 loc) · 1.15 KB
/
main.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
// Bitwise (Operador bit a bit)
console.log('5 & 1:', 5 & 1)
console.log('5 | 1:', 5 | 1)
console.log('(~5):', ~5)
console.log('5 ^ 1:', 5 ^ 1)
console.log('5 << 1:', 5 << 1)
console.log('5 >> 1:', 5 >> 1)
// TYPE OF
console.log('typeof 1', typeof 1)
console.log('typeof packt', typeof 'packt')
console.log('typeof true', typeof true)
console.log('typeof [1,2,3]', typeof [1, 2, 3])
console.log('typeof {name: jhon}', typeof { name: 'jhon' })
// FALSE AND TRUE
console.log('\ntruthy and falsy\n')
function testTruthy(val){
return val? console.log('truthy') : console.log('falsy')
}
testTruthy(true)
testTruthy(false)
testTruthy(new Boolean(false))
testTruthy('')
testTruthy('Packt')
testTruthy(new String(''))
testTruthy(1)
testTruthy(-1)
testTruthy(NaN)
testTruthy(new Number(NaN))
testTruthy({})
let obj = {name: 'jhon'}
testTruthy(obj)
testTruthy(obj.name)
testTruthy(obj.age)
let n = ''
function Developer(){
this.name = 'Nilton'
this.job = 'Full stack developer'
this.printDeveloper = function(){
console.log(`${this.name} is a ${this.job}`);
}
}
let developer = new Developer()
console.log(developer.name)
developer.printDeveloper()