Kelvin Weather
//Current temperature in kelvin degrees.
const kelvin = 0;
//Convert kelvin to celsius
const celsius = kelvin-273;
//Convert celsius to fahrenheit
let fahrenheit = celsius * (9/5) + 32;
//Round down fahrenheit variable
fahrenheit = Math.floor(fahrenheit);
console.log(`The temperature is ${fahrenheit} degrees Fahrenheit.`);
let newton = celsius * (33/100);
newton = Math.floor(newton);
console.log(`The temperature is ${newton} degrees Newton.`)
Dog Years
//my current age
const myAge = 23;
//early years
let earlyYears = 2;
earlyYears *= 10.5;
//laterYears
let laterYears = myAge-2;
laterYears *= 4;
console.log(earlyYears);
console.log(laterYears);
//my age in dog years
let myAgeInDogYears = earlyYears + laterYears;
//Change my name to lower case
let myName = "Soyeon".toLowerCase();
//Show my age in dog years
console.log(`My name is ${myName}. I am ${myAge} years old in human years which is ${myAgeInDogYears} years old in dog years.`)
'Front-End > JavaScript' 카테고리의 다른 글
Learn JavaScript_Arrays (0) | 2022.07.20 |
---|---|
Learn JavaScript_Conditionals (0) | 2022.07.14 |
자바스크립트의 시작-웹과 Javascript (0) | 2022.03.27 |
자바스크립트의 실행 방법과 실습 환경 (0) | 2022.03.27 |