//This will load the code into the memory no matter
//you call it or not
function diffOfSquares(a,b){
return a*a -b*b;
} //This code will only load into memory when you call it.
var diff = function diffOfSquares(a,b){
return a*a-b*b;
}; diff(9,5); //Call diff function instead of diffOfSquares //So why we still need diffOfSquares, since we don't call it /**
Anonymour Function
*/
var diff = function(a,b){
return a*a-b*b;
}; //You can use console.log(diff); It will print out the
//function instead of the value, so you can check what
//this function refer to. /********************************************/ var greeting = function(){
alert("Thank for fucking!");
}; closeTerminal(greeting); function closeTerminal(message){ ...
message();
....
} //We pass greeting as param to the closeTerminal function
/*
function closeTerminal(greeting){
...
greeting();
...
}
*/
//The out put would be
//"Thank for fucking!" /*********************************************/
//According to difference cases, the greeting message
//may be different.
//For example, newCustomer & oldCustomer, we want to
//take them differently. var greeting;
... //Some code to sets new newCustomer to ture of false
if(newCustomer){
greeting = function(){
alert("Thanks for funcking!");
};
}else{
greeting = function(){
alert("Welcome to be fucked!");
};
} closeTerminal(greeting);
//if newCustomer is true, --> Thanks for funcking!
//if newCustomer is false, --> Welcome to be fucked!

[Javascript] Funciton Expression的更多相关文章

  1. [label][翻译][JavaScript Regular Expression]JavaScript Regular Expressions

    原文:http://www.javascriptkit.com/javatutors/re.shtml 校验用户的输入是每一个软件开发者的必须要做的事情. 正则表达式与模式 如何在JavaScript ...

  2. JS正则表达式(JavaScript regular expression)

    RegExp直接量和对象的创建 就像字符串和数字一样,程序中每个取值相同的原始类型直接量均表示相同的值,这是显而易见的.程序运行时每次遇到对象直接量(初始化表达式)诸如{}和[]的时候都会创建新对象. ...

  3. [Javascript] Function Expression Ex, Changing Declarations to Expressions

    Inside the Haunted Hickory House file, developers for the Forest of Function Expressions Theme Park ...

  4. javascript URL实现简易书签

    简介 在HTML中,我们可以将js嵌入到script标签中,可以嵌入到行内代码中,也可以嵌入到src(href)中. 后者称作javascript URL.该方式的URL格式固定:javascript ...

  5. javascript基础语法——表达式

    × 目录 [1]原始表达式 [2]复杂表达式 前面的话 一般地,关于javascript基础语法,人们听得比较多的术语是操作符和语句.但是,其实还有一个术语经常使用,却很少被提到,这就是javascr ...

  6. javascript:void(0) ,设置a链接无效,设置点击a页面不刷新,不跳动

    http://www.cnblogs.com/opper/archive/2009/01/12/1373971.html 我想使用过ajax的都常见这样的代码: <a href="ja ...

  7. Javascript中void操作符

    Javascript中void是一个操作符,该操作符指定要计算一个表达式但是不返回值. void操作符用法格式如下:1.javascript:void (expression)2.javascript ...

  8. JavaScript简易教程(转)

    原文:http://www.cnblogs.com/yanhaijing/p/3685304.html 这是我所知道的最完整最简洁的JavaScript基础教程. 这篇文章带你尽快走进JavaScri ...

  9. javascript知识点记录(1)

    javascript一些知识点记录 1.substring,slice,substr的用法 substring 和slice 都有startIndex 和 endIndex(不包括endInex),区 ...

随机推荐

  1. Educational Codeforces Round 13 D. Iterated Linear Function 水题

    D. Iterated Linear Function 题目连接: http://www.codeforces.com/contest/678/problem/D Description Consid ...

  2. Spotlight on linux 监控 linux服务器资源

    步骤一:在window主机上安装spotlight 下载地址:http://worlddownloads.quest.com.edgesuite.net/Repository/www.quest.co ...

  3. 腾讯的网站是如何检测到你的 QQ 已经登录?

    在 QQ 已经登录的情况下,手动输入网址打开 QQ 邮箱 或者 QQ 空间 等腾讯网站,可以看到网页已经检测到本地 QQ 客户端已经登录,于是用户可以很方便地一键登录网站而不必再输入用户名密码. 这实 ...

  4. Git_创建标签

    在Git中打标签非常简单,首先,切换到需要打标签的分支上: $ git branch * dev master $ git checkout master Switched to branch 'ma ...

  5. C++使用autoreconf -vi出现error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation.

    安装这个:libtool  libsysfs yum install -y libtool libsysfs 参考: https://blog.csdn.net/yusiguyuan/article/ ...

  6. 【scrapy】使用方法概要(四)(转)

    [请初学者作为参考,不建议高手看这个浪费时间] 上一篇文章,我们抓取到了一大批代理ip,本篇文章介绍如何实现downloaderMiddleware,达到随即使用代理ip对目标网站进行抓取的. 抓取的 ...

  7. android aapt 用法 -- ApkReader

    aapt 是android assert packaging tool的缩写,具体如下: 1. 列出apk包的内容 aapt l[ist] [-v] [-a] file.{zip,jar,apk} - ...

  8. sql 递归查询所有的下级

    --> 生成测试数据表: [tb] IF OBJECT_ID('[Users]') IS NOT NULL     DROP TABLE [Users] GO CREATE TABLE [Use ...

  9. Geeks 一般二叉树的LCA

    不是BST,那么搜索两节点的LCA就复杂点了,由于节点是无序的. 以下是两种方法,都写进一个类里面了. 当然须要反复搜索的时候.能够使用多种方法加速搜索. #include <iostream& ...

  10. 2008 SCI 影响因子(Impact Factor)

    2008 SCI 影响因子(Impact Factor) Excel download 期刊名缩写 影响因子 ISSN号 CA-CANCER J CLIN 74.575 0007-9235 NEW E ...