Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

for of get index

for (const v of ['a', 'b', 'c']) {
  console.log(v)
}

// get index
for (const [i, v] of ['a', 'b', 'c'].entries()) {
  console.log(i, v)
}
Comment

for of index

for (const [i, v] of ['a', 'b', 'c'].entries()) {
  console.log(i, v)
}
Comment

for of loop get index in javascript

const names=["shirshak","Bigyan","Savyata"];
for(let name of names){
console.log(name); //output all name 
console.log(names.indexOf(name)); // index 0,1,2
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: open url in new tab javascript 
Javascript :: javascript fill 2d array 
Javascript :: random in range js 
Javascript :: Get random name from an array in javascript 
Javascript :: break camelcase codewars 
Javascript :: getelementsbyclassname.style.display 
Javascript :: get all mondays in calendar+js 
Javascript :: raspberry pi install node js 
Javascript :: javascript get 7 days from now 
Javascript :: react ReferenceError: regeneratorRuntime is not defined 
Javascript :: horizontal divider react native 
Javascript :: error java.io.filenotfoundexception tessdata/eng.traineddata 
Javascript :: js get mouseclick 
Javascript :: discord embed image with file discord js 
Javascript :: javascript change webpage title 
Javascript :: disable editing ace code edior 
Javascript :: javascript random color 
Javascript :: NullInjectorError: R3InjectorError httpclient 
Javascript :: Factorial of Number in Javascript using Recursive call in javascript 
Javascript :: http request in js 
Javascript :: element is hidden jquery 
Javascript :: aabb javascript 
Javascript :: js generate random boolean 
Javascript :: javascript replace vowel 
Javascript :: validate aadhaar number in javascript 
Javascript :: javascript stop youtube video 
Javascript :: js int to string 
Javascript :: Iterating through an Object 
Javascript :: javascript string get last two character 
Javascript :: javascript check if two date are ugual 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =