-
자바스크립트 문법 1 - 변수(Variable)와 자료형(Data Type) 해답프론트엔드/Javascript 연습과제 해답 2022. 1. 15. 21:19728x90
* 연습과제 1~3
let sofaPrice = 360000 let sizeOfShoes = 275 const PI = 3.14
* 연습과제 4
const name = "sunrise" const message = "Happy halloween, " // 구현하기 console.log(message + name) console.log(`${message} ${name}`)
* 연습과제 5
const letter = 'Dear syleemomo. \n\ Hello, syleemomo ^^ \n\ My name is kiki. Your sincere friend \n\ How are you thesedays? \n\ Are you busy or not? \n\ I guess you haven\'t sleep much last night \n\ I am spending good day thesedays ! \n\ I hope to see you soon. See you later :)' console.log(letter)
* 연습과제 6
const favorFoods = ["짜장", "짬뽕", "탕수육"]
* 연습과제 7
const favorFood = {name: '불고기버거', price: 2300, type: '양식'}
* 연습과제 8
const hoursForDay = 24 const bookName = "Harry Potter" const isChecked = true // 자료형 검사하기 console.log(typeof hoursForDay) console.log(typeof bookName) console.log(typeof isChecked)
* 연습과제 9
const cities = ["seoul", "deagu", "busan"] const bookInfo = { name: 'Harry Potter', price: 17000, author: 'J.K Rolling' } // 객체인지 배열인지 구분하기 - 자료형 검사 console.log(Array.isArray(cities)) console.log(Array.isArray(bookInfo)) console.log(cities instanceof Array) console.log(bookInfo instanceof Array)
* 연습과제 10
const distanceSeoulToBusan = 370 const sizeOfYourHeight = 275.9 // 정수형인지 실수형인지 구분하기 - 자료형 검사 console.log(Number.isInteger(distanceSeoulToBusan)) console.log(Number.isInteger(sizeOfYourHeight))
* 연습과제 11
const speedOfCar = "37.5 m/s" const heightOfYourFriend = "289 cm" // 숫자형으로 변환하기 console.log(parseFloat(speedOfCar)) console.log(parseInt(heightOfYourFriend))
* 연습과제 12
const heightOfYourFriend = 289 const temperature = 13.9 const fruits = ["apple", "banana", "orange"] // 문자열 타입으로 변환하기 console.log(heightOfYourFriend.toString()) console.log(temperature.toString()) console.log(fruits.toString())
728x90'프론트엔드 > Javascript 연습과제 해답' 카테고리의 다른 글
자바스크립트 문법 12 - 함수(function)의 기본 해답 (0) 2022.01.26 자바스크립트 문법 11 - 객체(Object) 해답 (0) 2022.01.16 자바스크립트 문법 2 - 브라우저에서의 자바스크립트 해답 (0) 2022.01.15 자바스크립트 문법 5 - 이벤트(Event) 처리하기 3 해답 (0) 2022.01.15 자바스크립트 문법 4 - 이벤트 (Event) 처리하기 2 해답 (0) 2022.01.15