官术网_书友最值得收藏!

Chapter 3. Functions

Mastering functions is an important skill when you learn any programming language and even more so when it comes to JavaScript. This is because JavaScript has many uses for functions, and much of the language's flexibility and expressiveness comes from them. Where most programming languages have a special syntax for some object-oriented features, JavaScript just uses functions. This chapter will cover:

  • How to define and use a function
  • Passing parameters to a function
  • Pre-defined functions that are available to you "for free"
  • The scope of variables in JavaScript
  • The concept that functions are just data, albeit a special type of data

Understanding these topics will provide a solid base that will allow you to dive into the second part of the chapter, which shows some interesting applications of functions:

  • Using anonymous functions
  • Callbacks
  • Self-invoking functions
  • Inner functions (functions defined inside functions)
  • Functions that return functions
  • Functions that redefine themselves
  • Closures
主站蜘蛛池模板: 阳春市| 洛阳市| 仁怀市| 潜江市| 波密县| 玛曲县| 静海县| 陈巴尔虎旗| 九寨沟县| 大埔县| 文昌市| 盱眙县| 额尔古纳市| 大英县| 新密市| 永和县| 商南县| 益阳市| 金溪县| 宣城市| 麦盖提县| 上林县| 东辽县| 成都市| 苏尼特左旗| 安龙县| 武功县| 宁化县| 河曲县| 白山市| 德兴市| 龙南县| 文昌市| 竹山县| 黎城县| 轮台县| 江安县| 通化市| 大竹县| 施甸县| 新巴尔虎左旗|