Nalini1998 / Project_Public

MIT License
2 stars 0 forks source link

What would the output of this block of code be? #552

Closed Nalini1998 closed 1 year ago

Nalini1998 commented 1 year ago

What would the output of this block of code be?

const animal = 'cat';

for (let i = 0; i < animal.length; i++) {
  console.log(animal[i]);
  for (let j = 1; j < 4; j++) {
    console.log(j);
  }
}

A. 1 c a t 2 c a t 3 c a t

B. 1 c 2 a 3 t

C. c 1 2 3 a 1 2 3 t 1 2 3

D. c a t 1 2 3

Nalini1998 commented 1 year ago

I chose C. c 1 2 3 a 1 2 3 t 1 2 3