Perfection Kills
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script>
window.onload=function(){
/*
1.
(function(){
alert(typeof(arguments));
})();
自执行函数,结果为object
*/
/*2.
var f = function g(){ return 23; };
alert(typeof g());*/
//g只能在内部调用,结果为 g is not undefined /*3.(function(x){
delete x;
return x;
})(1);*/
//delete只能删除某个函数下的属性,不能删除变量以及参数,这里的x为形参,结果为1 /*4.
var y = 1, x = y = typeof x;
alert(x);
因为typeof返回的是字符串,并且表达式从右向左计算,因此结果为"undefined"*/ /*5.
(function f(f){
return typeof f();
})(function(){ return 1; });
自执行函数,把1传给f,结果number*/ /*
6.
var foo = {
bar: function() { return this.baz; },//this指向foo.bar,但其实是window
baz: 1
};
(function(){
return typeof arguments[0]();
})(foo.bar);//结果为undefined*/ /*7.
var foo = {
bar: function(){ return this.baz; },
baz: 1
}
typeof (f = foo.bar)();
;*/ /*8.
var f = (function f(){ return "1"; }, function g(){ return 2; })();
alert(typeof f);
//分组选择符,返回最后面的那个值*/ /*9.
var x = 1;
if (function f(){}) {
x += typeof f;//1+undefined字符串连接
}
x;*/ /*10.
var x = [typeof x, typeof y][1];
typeof typeof x;//返回字符串string*/ /*11.
(function(foo){
return typeof foo.bar;
})({ foo: { bar: 1 } });//只有foo一个属性,返回undefined*/ /*12.
(function f(){//函数声明预解析,结果为2,覆盖前面的1和2
function f(){ return 1; }
return f();
function f(){ return 2; }
})();*/ /*13.
function f(){ return f; }
new f() instanceof f;//f()变成了f对象,结果为false*/ /*14.
with (function(x, undefined){}) length;
//计算函数的长度,即参数的个数,结果为2*/
}
</script>
</head>
<body>
</body>
</html>
网址:http://perfectionkills.com/
Perfection Kills的更多相关文章
- JavaScript 风格指导(Airbnb版)
JavaScript 风格指导(Airbnb版) 用更合理的方式写 JavaScript 原文 翻译自 Airbnb JavaScript Style Guide . 目录 类型 引用 对象 数组 解 ...
- Airbnb JavaScript Style Guide
Airbnb JavaScript Style Guide() { 用更合理的方式写 JavaScript ES5 的编码规范请查看版本一,版本二. 翻译自 Airbnb JavaScrip ...
- HDOJ 1323 Perfection(简单题)
Problem Description From the article Number Theory in the 1994 Microsoft Encarta: "If a, b, c a ...
- (25)Teach girls bravery, not perfection
https://www.ted.com/talks/reshma_saujani_teach_girls_bravery_not_perfection/transcript00:12So a few ...
- (12)We should aim for perfection — and stop fearing failure
https://www.ted.com/talks/jon_bowers_we_should_aim_for_perfection_and_stop_fearing_failure/transcrip ...
- poj 1528 Perfection
题目链接:http://poj.org/problem?id=1528 题目大意:输入一个数n,然后求出约数的和sum,在与这一个数n进行比较,如果sum>n,则输出ABUNDANT,如果sum ...
- Kills all phantomjs instances, disregard of their origin python关闭进程
Python/Linux quit() does not terminate PhantomJS process · Issue #767 · SeleniumHQ/selenium https:// ...
- Gym 100703I---Endeavor for perfection(尺取)
题目链接 http://codeforces.com/problemset/gymProblem/100703/I Description standard input/outputStatement ...
- CF GYM 100703I Endeavor for perfection
题意:有n个学习领域,每个领域有m个课程,学习第i个领域的第j个课程可以获得sij个技能点,在每个领域中选择一个课程,要求获得的n个技能点的最大值减最小值最小,输出符合要求的策略. 解法:尺取法.将课 ...
随机推荐
- scala的静态,单列模式
package com.test.scala.test /** * 单例对象,这种对象不能提供构造函数 */ object SingleObject { private var lastnumber= ...
- simpleBLEPeripheral.c 文件分析
这个配置或者说任务, 让这个蓝牙设备成为了一个简单的BLE外设. 这里定义了外设的广播数据, 以及最重要, char被改变之后的回调, 引出后来的coreHandler里面的, ack 以及写e2pr ...
- is_user_logged_in()
function is_user_logged_in() { $user = wp_get_current_user(); return $user->exists(); } wp_get_cu ...
- ServiceStack.Redis 使用教程
http://www.cnblogs.com/shanyou/archive/2011/11/10/2245082.html https://github.com/ServiceStack/Servi ...
- PHP文件系统处理相关操作
<?php/* PHP文件系统处理 * 所有文件处理都是使用系统函数完成的. * 是基于Linux/Unix系统为模型 * * 文件系统处理的作用: * 1. 所有的项目离不开文件处理 * 2. ...
- JavaEE基础(二十二)/IO流
1.IO流(序列流) 1.什么是序列流 序列流可以把多个字节输入流整合成一个, 从序列流中读取数据时, 将从被整合的第一个流开始读, 读完一个之后继续读第二个, 以此类推. 2.使用方式 整合两个: ...
- HDU 3887:Counting Offspring(DFS序+树状数组)
http://acm.hdu.edu.cn/showproblem.php?pid=3887 题意:给出一个有根树,问对于每一个节点它的子树中有多少个节点的值是小于它的. 思路:这题和那道苹果树是一样 ...
- quick-cocos2d-x 接入支付宝(android)(转,待验证)
quick-cocos2d-x 实现在lua里面完成android支付宝的接入 一.支付宝注册是很麻烦的一个过程,本文就不解释了,想了解的去官网看下注册流程.然后下载他们的sdk-WS_SECURE_ ...
- Linux软件的安装与卸载
configure作用:是源码安装软件时配置环境用的 他根据你的配置选项和你的系统情况生成makefile文件 为make 做准备 最常用的参数: ./configure --prefix 作用: 不 ...
- HDU 4708:Rotation Lock Puzzle
Rotation Lock Puzzle Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Oth ...