Javascript alternative console

Does anyone know an app, which can be used to run simple .js codes?
I want to understand how the code works, see what my mistakes are and I can’t do it here.

So let’ say I have task to return a sequence [1,2,3,4]
Let’s say with my code I generated a sequence [1,2,3], or may be I didn’t generate anything or generated [1,2,3,4,5].
When I run code here if it’s not what’s expected, I get “Your code should return [1,2,3,4]”.

So it doesn’t say what’s wrong, what I generated. So it’s quite difficult to understand what I did wrong, what my mistake is and how to modify my code based on such a response.

What I want the console to tell me that my output is [1,2,3] or that I don’t generate any response, etc. So I could see what I’m doing.

If you include console.log() statements in your code, even in the FCC editor, you can view the output of that in the Chrome Developer Tools console (or whatever browser you use, most have a Developer Tools option).

Alternatively, I will often take the code snippet from the FCC editor, and paste it into a repl - sort of like a codepen/fiddle/etc, only with a HUGE number of languages available. repl includes a console in its own editor, as well as allowing you to send messages to the browser’s developer console.

1 Like

I tried to include console.log over here it’s still doesn’t say what I am doing wrong. It just says that his ( console) expectations don’t match mine.

For example:

Basic JavaScript: Iterate Odd Numbers With a For Loop

// Push the odd numbers from 1 through 9 to  `myArray` using a  `for` loop.
 //I put:

// Only change code below this line.
for (var i = 1; i < 9; i += 2) {
myArray.push(i);
}
console.log(myArray)

So I get as a response " // running tests
myArray should equal [1,3,5,7,9].
// tests completed

What I want to see is that I got myArray is equal to equal [1,3,5,7].

Its kind of confusing the way they do it but the logs disappear in the FCC console once you hit “run tests”, if you just change the code with that console.log before hitting run it should show up.

I always found it easier to just work in the developers console in chrome, ctrl+shift+i on windows or right click on the page and select “inspect”, then you can paste into the console tab

hmm but if I change the code with console.log before I hit run tests nothing shows up.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

1 Like

Do you have the browser console open?