J's Rhapsody

[Javascript]문제 1.2: Changin Declarations to Expressions 본문

IT/JAVASCRIPT

[Javascript]문제 1.2: Changin Declarations to Expressions

J's Rhapsody 2018. 1. 11. 12:51

Changin Declarations to Expressions

Developers for the Forest of Function Expressions Theme Park have created a function declaration named forestFright, but they’ve decided not to keep the function in memory.

Convert the function from a named function declaration to an anonymous function expression and assign it to a variable called runAway.

1
2
3
4
5
6
7
var runAway = function () {
  var toAlert = "";
  for (var i = 0; i < 5; i++) {
    toAlert = toAlert + "Lions, Tigers, and Bears, Oh My!!\n";
  }
  alert(toAlert);
};
cs


Comments