-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfundamentals.js
More file actions
58 lines (42 loc) · 954 Bytes
/
Copy pathfundamentals.js
File metadata and controls
58 lines (42 loc) · 954 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
// Modules with export and import
export function sayHi(user) {
console.log(`Hello, ${user}!`);
}
export let user = "Henrich";
//Arrow Functions
export let sum = (a, b) => a + b;
export let sub = (a, b) => a - b;
export let mul = (a, b) => a * b;
export let div = (a, b) => a / b;
export let add = function(a, b) {
return a + b;
};
export let multiBy2 = n => n * 2;
export let sayMyName = () => console.log("Hello World");
//Objects
export let userObj = new Object(); // "object constructor" syntax
userObj = {
name : "John",
age : 39,
sex : "M",
isEducated: true,
"hello world india" : false
}
export let makeUser = (name, age) => {
return {
name,
age,
};
}
// in Operator
export let empObj = {
name : "Dickson "
};
export function addition(x, y) {
return x + y
}
export let additionArrow1 = (x, y) => x + y
export let additionArrow2 = (x, y) => {
let z = x + y
return z
}