Basic JavaScript - Decrement a Number with JavaScript

I need help with this test, What’s missing?

var myVar = 11;

// Only change code below this line
myVar = myVar -2 +1;
myVar--;
var myVar = 5 + 5;

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Decrement a Number with JavaScript

Link to the challenge:

Hi there,

I think what happened here is that you got caught with your hands in the cookie jar @Katekw . Reset the lesson and try again. But this time, do not touch anything above the line with the comment saying “Only change code below this line”.

Also, take another look at the instruction and examples from the challenge and consider whether you need all this code:

myVar = myVar -2 +1;
myVar--;
var myVar = 5 + 5;
  • duplicate “myVar” variable is in use, remove last one of them

lets refer to instructions

Change the code to use the -- operator on myVar

  • check out givcen example how to use “–” operator on variable and apply that same for “myVar”

happy learning :slight_smile:

1 Like

Thank you so much :slight_smile:

Thank you so much. :grin:

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