You are on page 1of 2

JavaScript

To convert Celsius to Fahrenheit, you can use the following formula:


F=C1.8+32

Directions:
Use this equation and the variables fahrenheit and celsius to print the Fahrenheit
equivalent of 12C.

NOTE: "12C" reads as "12 degrees Celsius".

Your Code:
/*

* Programming Quiz: Converting Tempatures (2-2)

* Use the Celsius-to-Fahrenheit formula to set the fahrenheit varible:

* F = C x 1.8 + 32

* Log the fahrenheit variable to the console.

*/

var celsius = 12;

var fahrenheit = celsius* 1.8 + 32

console.log( 12*1.8 + 32 );
Directions: Test 2
Build a single string that resembles the following joke.

Why couldn't the shoes go out and play?


They were all "tied" up!

Your joke should take the format of a question and answer. The first line should be a
question and the second line should be an answer.

Hint: You will need to use special characters to produce the following output.

/*
* Programming Quiz: All Tied Up (2-5)
*/

var joke = " Why couldn't the shoes go out and play?\n\tThey were all \"tied\" up!"

console.log(joke);

Test run: Why couldn't the shoes go out and play?


They were all "tied" up!

Test 3

/*

* Programming Quiz: First Expression (2-1)

* Write an expression that uses at least three, different, arithmetic operators

* to log the number 42 to the console.

*/

// this expression equals 4, change it to equal 42

console.log(1 + 5 - 2);

Answer: console.log(4 + (5 * 8) - 2); (exemplul meu)

You might also like