-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.js
More file actions
39 lines (39 loc) · 871 Bytes
/
function.js
File metadata and controls
39 lines (39 loc) · 871 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
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// for number
function addTwo(num) {
return num + 2;
}
addTwo(5);
// for string
function getUpper(val) {
return val.toUpperCase();
}
getUpper("ghggghgh");
// multiple value
function signUpUser(name, email, isPaid) { }
signUpUser("hamid", "hamid@gmail.com", true);
// login user
let loginUser = (name, email, isPaid = true) => {
if (isPaid === void 0) {
isPaid = false;
}
};
loginUser("hamid", "hamida@gmail.com");
// arrow function
const getHello = (s) => {
return "";
};
getHello("wsnjsw");
// mapping array
const heros = ["splender", "car", "maroti"];
// const heros = [1,2, 3]
heros.map((hero) => {
return `hero is ${heros}`;
});
function consoleError(errormsg) {
console.log(errormsg);
}
function handleError(errormsg) {
throw new Error(errormsg);
}