Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
Last console values correct
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started