본문 바로가기

바닐라코딩 부트캠프

js 연습문제

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function myFunction () {
  console.log("거북");
}
 
myFunction.prototype.hello = "HIHI";
 
 
var a = myFunction();
// undefined
// myFunction 호출의 실행 식에 console.log가 찍히는것이지
// 함수의 실행결과는 undefined
 
console.log(a.hello);
// error
 
 
 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function myFunction () {
  console.log("거북");
  return {
    hello: "파이리"
  };
}
 
myFunction.prototype.hello = "HIHI";
 
 
var a = myFunction();
// hello 속성이 들어있는 객체 리턴
 
console.log(a.hello);
// a 객체의 hello 속성 => "파이리" 리턴
 
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

 

 

 

 

'바닐라코딩 부트캠프' 카테고리의 다른 글

async 과제 리뷰  (0) 2020.01.13
개발공부시 참고사항  (0) 2020.01.12
async) memoize 메모  (0) 2020.01.10
async) reduce 메모  (0) 2020.01.10
quiz1) 0.1 + 0.2 === 0.3 ?  (0) 2020.01.10