Work is piling up! Add 8 to tasks and print it to the console

Is one of the practise and i need help because i can’t understand it it has the code:

let tasks = 2;

what i did is this:
let tasts = 2;
let i = 8;
console.log(tasks + i);

and what i get is wrong and i don’t know why please help

Does that look right, to you?

1 Like

what do you mean ? i understand what you mean

A most important skill to develop is spotting typos and spelling errors. It means training our eyes to look for them.

i apologies i wrote it miss spelled this one
sorry

2 Likes

Work is piling up! Add 8 to tasks and print it to the console.

let tasks = 2;

let i = 8;

console.log(tasks + i);

I did this and what i get it says ( Add 8 to tasks .)
what i meant before is that when i misspelled was here not on the work sorry if i confused you.
and it actually give me the answer it was (

let tasks = 2;

tasks += 8;
console.log(tasks); ) now my question why it didn’t accept what i done?

It was the misspelling (tasts) that was the problem. However, if the lesson did not ask us to assign 8 to i, then that could cause a problem with the lesson checker.

I don’t know the exact practice question statement, but comparing your solution to the Codecademy solution (in your post), I think the intent of the statement:

Add 8 to tasks and print it to the console.

is that the existing value of tasks needs to be incremented by 8 i.e. you need to add 8 to the existing value and then assign the resulting value to tasks. With this interpretation, I suspect the following modification to your code would likely be accepted:

let tasks = 2;
let i = 8;
tasks = tasks + i;     // or in concise form:    tasks += i;
console.log(tasks);
// Your solution:
let tasks = 2;
let i = 8;
console.log(tasks + i);
// In your solution, tasks + i is 10 but tasks is still 2.

// Codecademy solution:
let tasks = 2;
tasks += 8;
console.log(tasks); // In this version, tasks is 10.
2 Likes

ah i see thank you for explaining me. also i meant on here the forum i miss spelled (tasts) no when i did the lesson just here on the forum.

1 Like

thank you for making it clear for me.

1 Like