i noticed can multiply list scalar behavior weird if multiply: [2,3,4] * 3 i get: [2,3,4,2,3,4,2,3,4 ] understand results it's for? there other weird operations that? the main purpose of operand initialisation. example, if want initialize list 20 equal numbers can using loop: arr=[] in range(20): arr.append(3) an alternative way using operator: arr = [3] * 20 more weird , normal list operation on lists can find here http://www.discoversdk.com/knowledge-base/using-lists-in-python
i new js, trying access next element of array using onclick function no luck. var i, len; function quiz() { var quiz_questions = [ "who founder of facebook?", "who founder of google?" ]; len = quiz_questions.length; for(i = 0; < len; i++) { document.getelementbyid("demo").innerhtml = quiz_questions[i]; } } <button onclick="quiz();">click</button> <p id="demo"></p> can explain me did wrong here. your problem is, iterate through every question, every time click. remove loop , put i++ after setting question. maybe checking, if less array length before it, wouldnt bad idea. var i, len; = 0; function quiz() { var quiz_questions = [ "who founder of facebook?", "who founder of google?" ]; len = quiz_questions.length; document.gete...
Comments
Post a Comment