Step by Step guide for start coding at CodeChef using javascript
I have been searching for this over the internet for a long time but couldn’t find it. So, to help some of the fellow students I’m going to do my best to explain it clearly. Firstly! don’t go deep into the boilerplate code which I will be provided in the blog use it as a tool to make your work done.

function runProgram(input){
input = input.split(‘\n’);
for(var i=0; i<input.length; i++){
if(Number(input[i]) == 42){
return
}
else{
console.log(Number(input[i]))
}
}
}
if(process.env.USERNAME === “ranji”){
runProgram(``); //This is for input to be given in your system use any ide //like VS Code
}
else{
process.stdin.resume();
process.stdin.setEncoding(“ascii”);
let read = “”;
process.stdin.on(“data”, function (input) {
read += input;
});
process.stdin.on(“end”, function () {
read = read.replace(/\n$/,””)
runProgram(read);
});
process.on(“SIGINT”, function () {
read = read.replace(/\n$/,””)
runProgram(read);
process.exit(0);
});
}
You can download the VS Code software from here. This is the code for Universe Problem in CodeChef you can find the link to the question over here.
process.env.USERNAME === “Name”. You need to replace your system user name over here to get this program to execute in your system so that there is no need to provide input for every run. console.log(process.env.USERNAME) I’m providing this assuming that you are using a terminal or Git Bash in windows to run your program.
Try to copy this program and execute the problem in CodeChef and get a better understanding of how you can change an input as per the problem statement.
It’s done for now let’s execute more codes All the best! If you have any doubts do let me know. I will try my best to resolve that.