JavaScript


To prevent mischief code, JavaScript here runs under a custom v8 extension.

Reading

gets() - reads a line from the standard input

  • Examples
const line = gets();
const number = +gets();

Printing

print(message) - prints a new line on the standard output

  • Examples
print(5);
print(Math.sqrt(n));

Testing locally

To test your tasks locally put the following lines on top of your file:

const getGets = (arr) => {
    let index = 0;

    return () => {
        const toReturn = arr[index];
        index += 1;
        return toReturn;
    };
};
// this is the test
const test = [
  '5',
  '1 3',
  '123 -3',
  '4 -150',
];

const gets = this.gets || getGets(test);
const print = this.print || console.log;