Question: JavaScrip Problems #12. Refactor the previous code: create a function 'test' which has 1 argument called 'guess'. This function will return the string values you

JavaScrip Problems

#12.

Refactor the previous code: create a function 'test' which has 1 argument called 'guess'. This function will return the string values you previously used console.log() on. Then execute that function given (4) and the returned result should automatically print out in the console (being the last value in the console.)

Previous Code - use this to refractor:

answer = 4; guess = "just dead"; if (isNaN(guess)) console.log("no numbers given"); else console.log( answer == parseInt(guess) ? "correct": "wrong");

Output:

JavaScrip Problems #12. Refactor the previous code: create a function 'test' which

Last console values correct

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!