how to convert this C# code snippet to Javascript -


this question has answer here:

i need understand how javascript handles new string object in c# code below

var upperbound = 14; (int = 0; < upperbound; i++) {     console.writeline(new string('*', i));   } console.readline(); 

this how did in javascript:

var upperbound = 14;  for(var i=0;i<upperbound;i++){    console.log(new string("*", i));  }

am newbie in programming , started off javascript if appear dumb asking question pls pardon , assist me explaining.. thanks

there no equivalent new string("*", i) in js. need repetition yourself.

a handy hack array(i + 1).join("*"), not efficient don't think, needs construct array. best way loop , concatenate.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -