What is the output of the following JavaScript code? | Question 10

56. What will be the output of the following JavaScript code?

<script>
    let x = "Hello, IncludeHelp!";
    document.getElementById("test").innerHTML = x.slice(-13,-1);
</script>
  1. IncludeHelp!
  2. IncludeHelp
  3. ValueError
  4. Hello,

Answer: B) IncludeHelp

Explanation:

The negative value counts from the end of the string. Thus, the output will be "IncludeHelp".

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.