please vie the screenshot. I don\'t know if wrong or correct following the scree
ID: 3908433 • Letter: P
Question
please vie the screenshot. I don't know if wrong or correct following the screenshot format
Provide the following for Lab 4: Create a working function to determine if a number is even or odd, and pseudocode for your function. The tunction has the following requirements 1. It should be named isOdd 2 The function requires one parameter called num. This is the number that is being checked 3. Use of the JavaScript modulus operator-%-to test the number 4. The function is required to return a boolean value: true if odd, or false if not 5. The function should not display any output. It should only return the appropriate boolean value as specified . The following is required within the function to test the value: 1. An ifielse statement 2 Additional local function variables as necessary. Any additional variables used should be descriptive. You will lose points for non-descriptive identifiers. i.e. No single letter variable names. 3. Use of the JavaScript modulus operator-00 e.g. use modulus division with a number-) 2 % 2 will result in a zero remainder, 3 % 2 will result in a remainder of1. A number evenly divided by two (remainder 0) is even, otherwise it is odd (remainder 1) Add your to the provided lab 4 test program. It should run without error to receive full creditExplanation / Answer
function isOdd javascript
function isOdd(num){
if( num % 2 == 0 ) // Here the variable num is checked if it produces remainder 0 when dividing with 2
return true
return false
}
In your implementation you did not check the variable , you just simply checked 2 ... in line
if ( 2 % 2 == 0 )
which is wrong.
I have provided you with correct implementation above.
PLEASE RATE ! !
Thanks !
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.