Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This String Indexing and Length worksheet is part of the JavaScript Coding without HTML and CSS journey. Print it as a booklet?
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1word[0] | Alength | |
| 2word.length | Bname[1] | |
| 3Accesses the second character of a string | CWrong - use square brackets, not round brackets | |
| 4A property that never needs parentheses | DWrong - length is a property, not a method | |
| 5console.log(word(0)); | EAccesses the first character of the word string | |
| 6console.log(word.length()); | FGives the total number of characters in word |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
length — The number of characters in a string, accessed as a property without parentheses.console.log(word[0]);console.log(word.length);let ch = word[1];let name = "Amy";
console.log(name.length);let size = name.length;