3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[クイズ]javascriptと仲良くなるための一歩 第1話「関数」

Last updated at Posted at 2017-07-17

① 出力「?」は、何になるか?

function hoge(a,b){
  return a + b
}
var sum = hoge;

sum(3,4)
// => 7
hoge(3,4)
// => ?

② 出力「?」は何になるか

var sum = function hoge(a,b){
  return a + b
}

sum(3,4)
// => 7
hoge(3,4)
// => ?

:mouse:
:cow:
:tiger:
:rabbit:
:dragon_face:
:snake:
:horse:
:sheep:
:monkey_face:
:bird:
:dog:
:boar:
:mouse:
:cow:
:tiger:
:rabbit:
:dragon_face:
:snake:
:horse:
:sheep:
:monkey_face:
:bird:
:dog:
:boar:

① => 7

function hoge(a,b){
  return a + b
}
var sum = hoge;

hoge(3,4)
// => 7

② => Uncaught ReferenceError

var sum = function hoge(a,b){
  return a + b
}

hoge(3,4)
// => Uncaught ReferenceError: hoge is not defined
//    at <anonymous>:1:1
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?