Javascript Practice – Questions & Answers
Beginner Level
Q31. Write an if condition.
if(age > 18){
console.log("Adult");
}
Q32. Write a for loop.
for(let i=0;i<5;i++){
console.log(i);
}
Q33. Function syntax.
function greet(){
console.log("Hi");
}
Q34. Call a function.
greet();
Q35. Arrow function.
const add = (a,b) => a+b;
Intermediate Level
Q36. Reduce function.
arr.reduce((a,b)=>a+b);
Q37. String length.
name.length;
Q38. Convert string to number.
Number("10");Q39. JSON stringify.
JSON.stringify(obj);
Q40. JSON parse.
JSON.parse(jsonData);
Advanced Level
Q41. Debounce concept.
Limits function execution frequency.
Q42. Throttle concept.
Executes function at fixed intervals.
Q43. Strict mode.
"use strict";
Q44. Module export.
export default myFunc;
Q45. Module import.
import myFunc from "./file.js";
No comments:
Post a Comment