2018-09-30 23:01:58 +01:00
---
id: 56533eb9ac21ba0edf2244b3
title: Convert Celsius to Fahrenheit
challengeType: 1
2019-07-31 11:32:23 -07:00
forumTopicId: 16806
2018-09-30 23:01:58 +01:00
---
2020-11-27 19:02:05 +01:00
# --description--
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times `9/5` , plus `32` .
You are given a variable `celsius` representing a temperature in Celsius. Use the variable `fahrenheit` already defined and assign it the Fahrenheit temperature equivalent to the given Celsius temperature. Use the algorithm mentioned above to help convert the Celsius temperature to Fahrenheit.
# --hints--
`convertToF(0)` should return a number
```js
assert(typeof convertToF(0) === 'number');
2018-09-30 23:01:58 +01:00
```
2020-11-27 19:02:05 +01:00
`convertToF(-30)` should return a value of `-22`
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
assert(convertToF(-30) === -22);
```
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
`convertToF(-10)` should return a value of `14`
2018-09-30 23:01:58 +01:00
```js
2020-11-27 19:02:05 +01:00
assert(convertToF(-10) === 14);
```
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
`convertToF(0)` should return a value of `32`
```js
assert(convertToF(0) === 32);
2018-09-30 23:01:58 +01:00
```
2020-11-27 19:02:05 +01:00
`convertToF(20)` should return a value of `68`
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
assert(convertToF(20) === 68);
```
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
`convertToF(30)` should return a value of `86`
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
assert(convertToF(30) === 86);
```
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
# --seed--
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
## --seed-contents--
```js
function convertToF(celsius) {
let fahrenheit;
return fahrenheit;
}
convertToF(30);
```
# --solutions--
2018-09-30 23:01:58 +01:00
```js
function convertToF(celsius) {
let fahrenheit = celsius * 9/5 + 32;
return fahrenheit;
}
convertToF(30);
```