Test your code by modifying these values

Test your code by modifying these values
0

#1

A lot of the JavaScript challenges have the comment “Test your code by modifying these values” at the bottom followed by a function or something to execute.

I can’t figure out how to easily execute the code after I change this last line. The only option seems to be to “Run the Tests”.

Is there anyway to execute the code without selecting the “Run the Tests” button?

A workaround I have been doing is changing the code to set a variable equal to the function and doing a console log. See below. This does display the results in the bottom pane without having to “Run the Tests”.

I am checking with the community to see if there is a better way.

Workaround:

Change:

// Test your code by modifying these values
checkObj(“pet”);

To:

// Test your code by modifying these values
var test = checkObj(“pet”);
console.log(test)


#2

repl.it is an excellent tool for working on your JavaScript, although there are may others and you can also just use your browser’s devtools console to run code.


#3

Thanks Ariel. I was not aware of repl.it.

I guess I could use VS Code and node to do the same. I didn’t think about that.

Either way, in FCC/repl.it/VDCode, still need to teak the code to display anything I want to see.