+ 1

text in loops

can i i use a text string in a loop like for(text=""){ document.write(text); }

27th Apr 2018, 11:28 AM
Cyia
Cyia - avatar
8 Answers
+ 4
You can use numbers in for loop. Strings cannot be used here
27th Apr 2018, 1:16 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 1
As far as i know...You can't. Dang I never even tried this..😂
27th Apr 2018, 11:47 AM
Akib
Akib - avatar
0
You wrong... Its possible use ANY boolean expression and if in expression are involved string its same: var s="" for(; s!="111"; ){ s+= "1" console.log(a) }
27th Apr 2018, 1:46 PM
KrOW
KrOW - avatar
0
KrOW look at Cyia's example. How can that use string!
27th Apr 2018, 2:02 PM
Akib
Akib - avatar
0
Cyia Can you explain better your question? What to you do want?
27th Apr 2018, 2:07 PM
KrOW
KrOW - avatar
0
thanks Krow and Akib.. i want to use a string and not a number..like a list of names thats going to execute a loop of names starting with A when a user inputs A
28th Apr 2018, 11:18 AM
Cyia
Cyia - avatar
0
I think you need conditional statements. You can also loop through an array of characters.
28th Apr 2018, 11:26 AM
Akib
Akib - avatar
0
so can you help what is after x<=
1st May 2018, 12:52 PM
Logan Hoffman
Logan Hoffman - avatar