Question: *ALL IN JAVASCRIPT Your code should always include descriptive comments. 1. Write a JavaScript for loop that will iterate from 0 to 15. For each

*ALL IN JAVASCRIPT

Your code should always include descriptive comments.

1. Write a JavaScript for loop that will iterate from 0 to 15. For each iteration, it will check if the current number is odd or even, and display a message to the screen.

Sample Output : "0 is even" "1 is odd" "2 is even"

2. Write a JavaScript function to get the first element of an array. Passing a parameter 'n' will return the first 'n' elements of the array. Test Data : console.log(first([7, 9, 0, -2])); console.log(first([],3)); console.log(first([7, 9, 0, -2],3)); console.log(first([7, 9, 0, -2],6)); console.log(first([7, 9, 0, -2],-3));

Expected Output : 7 [] [7, 9, 0] [7, 9, 0, -2] []

3. Create an object to hold information on your favorite recipe. It should have properties for title, servings, and ingredients (an array of strings). On separate lines (one console.log statement for each), log the recipe information so it looks like below. Use your own recipe. Creativity matters!

Cake

Serves: 2

Ingredients:

cinnamon

flour

sugar

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!