Help with Node.js Please correct error ======================== \'eslint -c .esl
ID: 3728440 • Letter: H
Question
Help with Node.js Please correct error
========================
'eslint -c .eslintrc.js sum.js'
'use strict'
let total = 0;
const cmds = process.argv;
for (let i = 2; i < cmds.length; i++) {
total += cmds[i] - 0;
}
console.log("The total is" + total + "!");
===================================
Please fix my code and pass it with Eslint(version 6)
https://eslint.org/demo
Messages Fixed Code 4:14 -'process' is not defined. (no-undef) 9:1 - Unexpected console statement. (no-console) 9:1- 'console' is not defined. (no-undef)Explanation / Answer
fixed code is below:
there is no console on that website so run with console:
'eslint -c .eslintrc.js sum.js'
'use strict'
var total = 0;
var cmds = process.argv;
for (var i = 2; i < cmds.length; i++) {
total += cmds[i] - 0;
}
console.log("The total is " + total + "!");
sample output:
The total is 0!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.