JS9_JavaScript Few Built In functions
setTimeout(function() { console.log("Hi.."); },2000);
clearTimeout(myObj);
//######################################################################################################
setInterval(function() { console.log("Hi.."); }, 2000);
clearInterval(myObj);
//######################################################################################################
let myVariable = function() { console.log("Hi2.."); }; //note: even if this line is <body><script> unless it is called it will not execute.
myVariable();
//######################################################################################################
const employee = {
firstName: '',
setName: function(name){
let splitName = (n) => {
let nameArray = n.split(' ');
this.firstName = nameArray[0];
}
splitName(name);
}
}
employee.setName('pavan kumar');
console.log(employee.firstName);
//######################################################################################################
//Array logics
const courses = [
{id: 1, name: 'course1'},
{id: 2, name: 'course2'},
{id: 3, name: 'course3'},
];
const courseExist = courses.find(c => c.id === 5);
const myNewCourse = {id: 4, name: 'course4'}
courses.push(myNewCourse);
courses.splice(2,1);
If you’re need to find a developer for your project, here check out this list of.
ReplyDelete