Javascript appending variables +=

Im getting an error that says that error says cannot read property ‘length’ of null please help:

Your code so far

// Example
var anAdjective = "awesome!";
var ourStr = "freeCodeCamp is ";
ourStr += anAdjective;

// Only change code below this line
var someAdjective = "Hard!";
var myStr = "Learning to code is ";
someAdjective += myStr;

Your browser information:

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

Link to the challenge:


To pass the challenge you have to append someAdjective to myStr variable. Your current version of the code is doing it in reversed order, so you append myStr to someAdjective.

As a result your code produces this output: Hard!Learning to code is. But it should be Learning to code is Hard!.

I hope this will help you to understand and fix your mistake.

1 Like