fork download
  1. let quote = 'I do not like green eggs and ham. I do not like them, Sam-I-Am.';
  2. let substring = 'green eggs and ham';
  3.  
  4. // Add your code here
  5.  
  6. let quoteLength = quote.length;
  7. let index = quote.indexOf(substring);
  8. let substringLength = substring.length + index;
  9.  
  10. let revisedQuote = quote.slice(0, substringLength + 1);
  11.  
  12.  
  13. // Don't edit the code below here!
  14.  
  15. section.innerHTML = ' ';
  16. let para1 = document.createElement('p');
  17. para1.textContent = `The quote is ${ quoteLength } characters long.`;
  18. let para2 = document.createElement('p');
  19. para2.textContent = revisedQuote;
  20.  
  21. section.appendChild(para1);
  22. section.appendChild(para2);
  23.  
Runtime error #stdin #stdout #stderr 0.02s 17072KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
prog.js:15:1 ReferenceError: section is not defined
Stack:
  @prog.js:15:1