I was practicing pattern printing in C and than i was try it in JavaScript but it don’t work

I was practicing pattern printing in C and than i was try it in JavaScript but the same code don’t give the same output, yeah i also change printf into console.log and scanf into prompt.C code link JS code link

I want you to solve this code and plz give me the better explanation on why this code is not run in javascript properly.