njdeane
njdeane

Reputation: 9

Chrome JavaScript Console

I am new to chrome dev tools (and coding). I am trying to run this javascript function in the chrome dev tools JS console and it won't work, it is code I have copied line for line from an online tutorial to check if its working. (i'm guessing its a dev tools setting or something as the code works on the online tutorial)

Any help would be much appreciated.

var output = [];
var count = 1;

function fizzBuzz() {
  output.push(count);
  count++;

  console.log(output);
}

Upvotes: 0

Views: 128

Answers (2)

Ijas
Ijas

Reputation: 86

You have to initialise the variables in Console.

Upvotes: 0

Harshana
Harshana

Reputation: 5496

You need to save the file and run it again by clicking the "play" icon.

enter image description here

Upvotes: 1

Related Questions