This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Q1: Create a template string of a button HTML Element. Save the title | |
// for the button in a separate var and use it in the button correctly. | |
let buttonTitle = "This is used to save value in DB"; | |
let btn = `<button title="${buttonTitle}">Save</button>`; | |
console.log(btn); | |
// Q2: Create a function that returns a list element (<li>) HTML | |
// use this function to create an ordered list HTML structure of numbers from |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let abc = () => { | |
let arr = Array.apply(0, Array(30)) | |
.map(function(val, index) { | |
return index; | |
}); | |
let err = 0 | |
let a = new Promise((resolve, reject) => { | |
arr = arr.map(val => { | |
if (val% 2== 0) { | |
return (val * val) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Question 1: Create an Array from 0...100 without using traditional For-loop | |
let array = Array(101).fill(1).map(item = (val , index) => index); | |
console.log("array of 0 to 100 "); | |
console.log(array); | |
// Question 2: Create an Array of only even numbers from the above array | |
let evenArray = array.filter( val => val % 2 == 0); |