I am currently learning JavaScript and I have accumulated numerous small pieces of code that I want to test.
Is there a way to do this in Chrome or any other browser without having to create a temporary .js/.html file?
Someone recommended using Chrome's console, but as far as I know, it only allows testing a single line of code, such as alert('myVar has a value');
. It does not seem possible to test multiple lines of script like
if(myVar){
alert('myVar has a value');
}
else {
alert('myVar does not have a value');
}
Furthermore, I would like the ability to run these tests offline and paste the JavaScript code snippets directly into the testing environment.