According to wikipedia:
Code golf is a type of recreational computer programming competition in which participants strive to achieve the shortest possible source code that implements a certain algorithm.
To cast a string into an integer you can divide by one:
input="2";
console.log(input / 1 + 2); //will print 4
console.log(input + 2); //will print 22
print("test"); //shorter than console.log("test")
You can cleverly use tag templates to save a few characters when calling functions with string parameters:
r="string".split``; //equivalent to "string".split("")
print(r); //(6) ["s", "t", "r", "i", "n", "g"]
readline is 8 characters long. If you need to use it more than twice, save it in a variable:
r=readline;
a=r();
b=r();
You can also save a series of calls:
r=()=>readline().split` `;
a=r();
b=r();