Javascript Practice – Questions & Answers
Beginner Level
Q16. JavaScript data types.
String, Number, Boolean, Object, Undefined, Null
Q17. Create a string variable.
let name = "Vijay";
Q18. Create an array.
let arr = [1,2,3];
Q19. Access array element.
arr[0];
Q20. Create an object.
let user = { name:"Vijay", age:25 };Intermediate Level
Q21. setInterval example.
setInterval(()=>{
console.log("Run");
},1000);
Q22. Array push.
arr.push(4);
Q23. Array pop.
arr.pop();
Q24. Map function.
arr.map(x => x*2);
Q25. Filter function.
arr.filter(x => x > 2);
Advanced Level
Q26. Try catch.
try{
risky();
}catch(e){
console.log(e);
}
Q27. Hoisting.
Variables/functions moved to top during execution.
Q28. Call stack.
Tracks function execution order.
Q29. Event bubbling.
Event propagates from child to parent.
Q30. Event delegation.
Handling events using parent element.
No comments:
Post a Comment