Hi,
I'm fairly new to using code runner and have set some questions that test some basic functions in JavaScript successfully. In those tests, I was trying to use some newer ECMAScript features, such as the **
raise to power operator. Initially, using this syntax failed with the out-of-the-box options but I found that I could add {esversion: 7}
to the Template params box and this solved the problem.
As I evolve my usage of CodeRunner, I am now wanting my students to write other methods for testing. However, I'm finding that some of the very recent JavaScript methods, syntax and functions - such as optional chaining, the trim()
function on a string, declaring class fields and the nullish coalescing operator, do not work and produce errors like the one shown below:
As I am keen for my students to be using the latest JavaScript syntax, is there a way I can get CodeRunner to recognise these functions, operators and syntax? I've tried upping the Template params to set the esversion
to 8, 9, 10 and 11 but with no success! Is this the right thing to do? Do I need to update the NodeJS version on the Jobe Server?
Thanks.
Ed Wright.