You are on page 1of 2

1.

let maximum = (a,b) => { if(a>b){


return a;}
else {
return b;
}
}

2.
const sum = (...args) => { var result=0;
args.forEach(function(args){
result+=args;})
return result;
}

3.
const states=[];
var [Chennai,Chandigarh]=[['Tamilnadu'],['Punjab','Haryana']];

module.exports = {states:[Chennai,Chandigarh]};

4.
Const greet= (name)=>{
return "Hello "+ name;
}

5.
const sum = (a,b) => {

return `The sum of ${a} and ${b} is ${a+b}`;

}
module.exports = {sum}

6.
class Car{
constructor(name,distance){
this.name=name;
this.distance=distance;
}
carDistance() {
return `${this.name} had travelled for ${this.distance} miles`;
}

let Car1 = new Car('Audi', 100);


const msg = Car1.carDistance();
console.log(msg);
module.exports = {msg}

7.
let email = Symbol();
let Employee = {
name : "rajesh",
phone :9800000000,
[email] : "rajesh@gmail.com"
};

let allKeys = Reflect.ownKeys(Employee);


let privateKeys = Object.getOwnPropertySymbols(Employee);
let publicKeys = Object.getOwnPropertyNames(Employee);

module.exports = {Employee, allKeys, privateKeys, publicKeys}

You might also like