Hello to anyone who may be reading this,
Lately I’ve been having some trouble with printing code including loops to the console. Because when I hit return, the console replies to the code with “undefined”. This goes for mozilla scratchpad, firefox and chrome. However, when I just do a simple code like “console.log(‘Something’);” the console prints the code correctly. How am I meant to practise when the console just says “undefined”?
Here’s the the code I’m trying to log:
var nuclearCountries = [
‘North Korea (DPRK)’,
northAmericanCentralCountry,
someAsian
];
var northAmericanCentralCountry = ‘United States of America’;
var someAsian = ‘India’;
for (var i = 0; i <= nuclearCountries.length; i++) {
}
console.log(nuclearCountries[i]);
Is there some problem with my code?
Help appreciated,
cats1000