https://s3-us-west-2.amazonaws.com/secure.notion-static.com/bcec5f15-1274-482b-b474-35b6b15d35f3/Untitled.png

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/aa8c4f5b-c907-4f4b-9df1-46ea68bdb92b/Untitled.png

(Kelvin Weather 계산 예제)

예제를 바탕으로 코드 짜기!

const kelvin = 0;
// 항상 변함이 없는 데이터 값 -> const
let celsius = kelvin - 273;
// celsius 는 kelvin에서 273을 뺀 값
let fahrenheit = celsius*(9/5)+32;
// celsius 를 통해서 Fahrenheit 를 계산하는 식
fahrenheit = Math.floor(fahrenheit);
// Fahrenheit 값을 정수로 환산시키기 위해서, Math.floor() 를 이용해서 전환시킨다.
console.log(The temperature is ${fahrenheit} degrees Fahrenheit.);
// console.log로 주어진 문장 찍고, TEMPERATURE 대신에, fahrenheit 값을 넣어준다. ``, ${}을 이용해서 하는 것이 좋다.
let Newton = celsius*(33/100);
// Newton의 celsius를 활용한 계산법
Newton = Math.floor(Newton);
// Newton을 정수화시킨다.
console.log(The temperature is ${Newton} degrees Newton.);
//Newton을 출력한다.