πŸ“Š JavaScript
Q. What will be the output of the following code snippet?
Code:
var a = "hello";
var sum = 0;
for(var i = 0; i < a.length; i++) {
   sum += (a[i] - 'a');
}
print(sum);
  • (A) 47
  • (B) NaN
  • (C) 0
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (B) NaN

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
268
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Admin
Publisher
πŸ“ˆ
96%
Success Rate