Help w/ JS challenge: suspected bug

Tell us what’s happening:
what’s happening is I used the code the way the challenge told me to, but I couldn’t pass the challenge for some reason. maybe a bug in the challenge…

Your code so far


// Example
var firstNameLength = 0;
var firstName = "Ada";

firstNameLength = firstName.length;

// Setup
var lastNameLength = 8;
var lastName = "Lovelace";

// Only change code below this line.

lastNameLength = lastName.length;


Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string

You seem to have modified this line:

var lastNameLength = 8;

It should be equal to 0 there or the tests get confused, thinking you’re trying to get it another way

1 Like

Ok lastNameLength is 8 but that value should be got from the code below.lastNameLength should be equal to 0.Don’t write it directly:

var firstNameLength = 0;
var firstName = "Ada";

firstNameLength = firstName.length;

// Setup
var lastNameLength = 0;
var lastName = "Lovelace";

// Only change code below this line.

lastNameLength = lastName.length;
1 Like

Thanks!! worked! maybe they should re-make the challenge and set the variable to 0

The starting value of that variable is 0, if you reset the code you can see it

1 Like