Question: Hello: I need help with this JavaScript Program. The colors red, blue, and yellow are known as the primary colors because they cannot be made

Hello:

I need help with this JavaScript Program.

The colors red, blue, and yellow are known as the primary colors because they cannot be made by mixing other colors. When you mix two primary colors, you get a secondary color, as shown here:

-When you mix red and blue, you get purple.

- When you mix red and yellow, you get orange.

- When you mix blue and yellow, you get green.

// Design a program that prompts the user to enter the names of two primary colors

// to mix and then calls the function findSecondayColor( ) passing both colors. The

// function returns the following number which indactes the resulting secondary

// color.

//

Colors passed - Number function returns

red and blue - 1 (represents purple)

red and yellow - 2 (represents orange)

blue and yellow - 3 (represents green)

2 of the same color - 4 (the same color)

anything else - 0 (indicated invalid color passed)

function findSecondaryColor(color1, color2) {

Hello: I need help with this JavaScript Program. The colors red, blue,

3

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!