Question: write the external (javascript) file and the corresponding html file that calls this extern file .js for both parts. Javascript function we will add a

write the external (javascript) file and the corresponding html file that calls this extern file .js for both parts.

Javascript function

we will add a user input that asks the user to enter the number of job duties that they want to see that you preformed at your previous job. When the user clicks a button, a function will be called and will then take this input and use it to specify an index number of an array that will be the starting point of the array values (duties) to be displayed. Through looping, we will then subtract 1 from the index number until it reaches 0 and display all of the values that are associated with the index numbers that were calculated during the loop.

Create an input that acts as a fill in the blank for a sentence that prompts the user to enter the number of job duties they want to see.

Create a button that calls a function when clicked (the function created in the next step)

Crate a function that takes the user input and assigns the value to a variable.

Create an array with at least five job duties in it. ( cooking, cleaning, organizing, getting groceries and walking dog)

5.

Create a while loop that runs while the variable (that represents the index value that we want to print) is greater than or equal to the minimum array value.

Within the while loop have two things happen.

Have the innerHTML of some element within your page be replaced with the array value that corresponds to the index number that we want printed

You specify the array value by the format arrayname[indexnumber]

Have the index subtract one from itself to count down

At this point your function should run, but it does not work properly. Only the array value at the last index is printed. To fix this, we need to concatenate the results of the loop.

i. Create a new variable outside of the loop and set it to be equal to blank (You do this by setting it equal to )

Within the loop, make this variable to be equal to itself plus the array value that we want printed.

Now change the innerHTML to be equal to this variable.

home / study / engineering / computer science / computer science questions and answers / JavaScript Function If The Salary Is Less Than 20000 It Is Not Enough, Else If The Salary Is ...

Question: JavaScript function if the salary is less than 20000 it is not enough, else if the salary is betw...

part2

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

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!