Skip to content

More than two choices

Watch it run · 1 of 3

Marks of 80

1const input = require("fs").readFileSync(0, "utf8").trim().split(/\s+/);
2let pos = 0;
3const next = () => input[pos++];
4
5const marks = Number(next());
6if (marks >= 90) {
7 console.log("A");
8} else if (marks >= 75) {
9 console.log("B");
10} else if (marks >= 40) {
11 console.log("C");
12} else {
13 console.log("Fail");
14}

Memory

number marks

80

Typed input

80

Output

(nothing yet)

line 5Read 80.

step 1 of 4