Kindy assess Math 1 skill test

Hi there,
I would really appreciate if anyone could check the JS for this skills test, specifically Step 5.

Code Pen

Thanks in advance.
Thom

Hi there @thomjavare, thanks for getting in touch!

Your CodePen link doesn’t appear to point to anywhere — can you check it, and send me the correct one? Thanks!

Sorry man, it seems the hyperlink button does not work so I just copied the link and pasted directly in the message field. Apologies.

And also thanks

@thomjavare no worries at all.

I’ve looked over your code, and it works really nicely - well done on some great work.

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

I think what needs to be looked at here is step 5’s direction to call the variable evenOddCheck. In the given code, a variable for evenOddResult is made. No where in the rest of the problem does the evenOddCheck variable get used. Therefore it doesn’t change the result of your paragraph stating if final result is even or if its odd.

@daedaluscode it does get used; check out the following block, which is the whole code, including the answer from our marking guide:


let finalResult;

let evenOddResult;

// Add your code here

let number1 = 4;
let number2 = 8;
let number3 = 12;
let number4 = 8;

let additionResult = number1 + number2;
let subtractionResult = number3 - number4;

finalResult = additionResult * subtractionResult;

evenOddResult = finalResult % 2;


// Don't edit the code below here!

section.innerHTML = ' ';
let para1 = document.createElement('p');
let finalResultCheck = finalResult === 48 ? `Yes, well done!` : `No, it is ${ finalResult }`;
para1.textContent = `Is the finalResult 48? ${ finalResultCheck }`;
let para2 = document.createElement('p');
let evenOddResultCheck = evenOddResult === 0 ? 'The final result is even!' : 'The final result is odd. Hrm.'
para2.textContent = evenOddResultCheck;

section.appendChild(para1);
section.appendChild(para2);
    

I see it now, for some reason i read over it and never saw the = at the end of it.

Hey Chris, how can I choose 4 numbers to make 48? what was your concept when you choose 4, 8,12 & 8 to make final result 48? please educate me. thanks

Hi there @mohsinrubel, and welcome to the community.

Let’s look at the follow block of code from earlier in the thread:

let number1 = 4;
let number2 = 8;
let number3 = 12;
let number4 = 8;

let additionResult = number1 + number2;
let subtractionResult = number3 - number4;

finalResult = additionResult * subtractionResult;

So we have our four numbers — 4, 8, 12, and 8.

We add the first number to the second one, which gives us 12.

We subtract the third number form the fourth one, which gives us 4.

We then multiple these two results together. 12 x 4 = 48.

So you can choose any four numbers, as long as the result is still 48 when you put them through these calculations.

Thank you @chrisdavidmills.