My keyboard back lash doesnt work


#1


Then, write an if/else statement that uses harryPotterFan as its condition. If it is true, then log, 'Mischief managed.'. If it is false, then log, 'I lead a muggle\'s life.'.

Note: Why is there a \ in 'I lead a muggle\'s life.'? Since the string is surrounded by single quotes, we can use a back slash to add a single quote within the string. This is called escaping a character.


Replace this line with your code. 
var harryPotterFan = true;
if (harryPotterFan) { 
  console.log('Mischief managed.');
} else { 
  console.log('I lead a muggle/'s life.');
}


#2

what is your question? You used a forward slash instead of a backslash.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.