Create pascal just for(){} looping | Sololearn: Learn to code for FREE!


Create pascal just for(){} looping

how to create pascal just for looping,not the other,please help me,i am less good in the case of mtk

10/15/2018 3:18:23 PM

Akmal Hikam

2 Answers

New Answer


thanksss bruhhh


pascal triangle? here: var triangle = [0, 1, 0]; function nextTriangle(){ triangle_ = [0]; for(var i=0;i<triangle.length-1;i++){ triangle_.push(triangle[i]+triangle[i+1]); } triangle_.push(0); return triangle_; } console.log(triangle); for(var j=0;j<10;j++){ //change here for more or less coloms triangle = nextTriangle() console.log(triangle); }