-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctions.js
More file actions
46 lines (40 loc) · 960 Bytes
/
Functions.js
File metadata and controls
46 lines (40 loc) · 960 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
const userName = function () {
console.log("hello waseem_akram");
};
//userName() // function call.
const sum = function (a, b) {
return a + b;
};
// const total=sum(5,"5"); //55
//const total=sum(5,null); //5
//const total=sum(5,undefined); //NAN
//const total=sum(5,Symbol); //5 function symbol()
//console.log(total);
const userLoggedIn = function (name) {
if (!name) {
return;
}
console.log(`hello user ${name} is loggedin`);
};
//console.log(userLoggedIn("waseem"));
//console.log(userLoggedIn(""));
//console.log(userLoggedIn(undefined));
//console.log(userLoggedIn(null));
function myFunc(theObject) {
theObject.make = "Toyota";
}
const mycar = {
make: "Honda",
model: "Accord",
year: 1998,
};
console.log(mycar.make); // "Honda"
myFunc(mycar);
console.log(mycar.make); // "Toyota"
function mufunc(thearray){
thearray[0]=30;
}
const arr=[45];
console.log(arr[0]); // 45
mufunc(arr);
console.log(arr[0]); //30