logo CodeStepByStep logo

partyOfThree

Language/Type: JavaScript basics escape sequences
Author: Melissa Hovik (on 2016/09/25)

What is the output produced by the following statements?

console.log("name\t\tnickname\tlevel");
console.log("Charizard\tCharlie\t\t5");
console.log("Squirtle\tBubbles\t\t6");
console.log("Pikachu\t\tPikachu\t\t100");
        

(NOTE ABOUT SPACING: Many students fail this problem by not understanding how the \t character works, causing them to have the wrong number of spaces. A tab inserts multiple spaces until the total number of characters on the current line so far is a multiple of 8. So for example, in the string "hi\thello\tgoodbye\tbeautiful\thi", the first \t becomes 6 spaces (because "hi" is 2 characters, so it takes 6 more to get to 8), the second \t is 3 spaces (because "hello" is 5 characters wide, so it takes 3 more characters to get to 8), the third is 1 (because "goodbye" is 7 characters), and the fourth \t is 7 spaces (because "beautiful" is 9 characters, so it takes 7 more to get to 16, which is the next multiple of 8).

output

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.