Question: JavaScript function if the salary is less than 20000 it is not enough, else if the salary is between 20000 and 25000 it is almost
JavaScript function
if the salary is less than 20000 it is not enough, else if the salary is between 20000 and 25000 it is almost enough, and (else) if the salary is greater than 25000 the salary is enough
Create the if...else if....else statement. You will need to use various operators found here: http://www.w3schools.com/js/js_comparisons.asp
1. The first test should test if the variable used to store the calculated salary (from the previous assignment) is less than 20000, If this condition is true, it should assign the value ". The salary is too little." to the undefined variable
2. The second test should test if the variable used to store the calculated salary is greater than 20000 and less than 25000 and should assign the value ". The salary is almost enough. Lets negotiate." to the undefined variable.
3. The last test should take place by default (else), if neither of the two previous conditions are met. It will assign the value ". This is a great salary for me." to the undefined variable.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
