someExperience
// 面试题1
var name = 'World';
(function () {
if (typeof name==='undefined') {
var name = 'jack';
console.log('Good bye' + name)
}else{
console.log('Hello' + name)
} })();
//Good byejack 答对了,变量提升 //
var str = 'hi';
console.log('Value' + (str==='hi')?'something':'nothing')//something //
var arr = [0,1,2];
arr[10] = 10;//[ 0, 1, 2, , , , , , , , 10 ]
var arr2 = arr.filter(function(x){
return x===undefined
});
console.log(arr2)//[] //
function showCase(value){
switch(value){
case 'A':
console.log('Case A');
break;
case 'B':
console.log('Case B');
break;
case 'C':
console.log('Case C');
break;
case 'D':
console.log('Case D');
break;
default:
console.log('unkonw')
}
}
showCase(new String('A'));//unkonw
console.log(new String('A'))//[String: 'A']
//
function isOdd(num){
return num%2 ==1;
}
function isEven(num){
return num%2 == 0;
}
function isSane(num){
return isEven(num) || isOdd(num)
}
var value = [7,4,'13',-9,Infinity];
var mapReruslt = value.map(isSane);
console.log(mapReruslt)//[ true, true, true, false, false ] //我的答案 true, true, false, false, false
//
console.log('5'+3);//
console.log('5'-3)// //
console.log(Array.prototype)//[]
console.log(Array.isArray(Array.prototype))//true 8
function sidEff(ary){
ary[0] = ary[2];
}
function bar(a,b,c){
c = 10;
sidEff(arguments);
return a+b+c
}
console.log(bar(1,1,1))//我的答案21结果是对的 function foo(a){
var a;
return a;
}
function bar(a){
var a = 'bye';
return a;
};
console.log([foo('hello'),bar('hello')])//[ 'hello', 'bye' ] //我的答案是undefined bye var a ={}; b =Object.prototype;
console.log(a.prototype === b,Object.getPrototypeOf(a)===b)//false true //我的答案true true
someExperience的更多相关文章
随机推荐
- .NET通用基本权限系统
DEMO下载地址: http://download.csdn.net/detail/shecixiong/5372895 一.开发技术:B/S(.NET C# ) 1.Windows XP以上 (支援 ...
- 基于jquery扩展漂亮的分页控件(ajax)
分页控件式大家在熟悉不过的控件,很多情况下都需要使用到分页控件来完成列表数据加载操作,在很多分页控件中有的编写麻烦,有的应用扩展比较复杂,有的分页控件样式比较丑陋,有的分页控件用户体验操作比较简单等等 ...
- mycat表拆分操作教程
1,迁移数据 举例说明,比如一个博客数据库数据表如下: 这里水平拆分,垂直拆分,只是做个简单的实验,真正的线上业务要根据情况,数据进行拆分. ? 1 2 3 4 5 6 7 8 9 10 11 12 ...
- ubuntu下查看文件md5
终端输入md5sum --help: md5sum --help用法:md5sum [选项]... [文件]...显示或检查 MD5(128-bit) 校验和.若没有文件选项,或者文件处为" ...
- xcode 4 制作静态库详解
合并.a文件,制作通用静态库 这二个库一个是用于真机运行的一个是用于模拟器运行的.其实我们可以利用lipo将这二个文件打包成一个通用的a文件.命令如下: 将/Users/user/Library/De ...
- Project Management - 3) Manage Your Meetings
1. 取消没有价值的会议 会议是有代价和成本的 不要举行顺序式的多人进度报告会议 eg: 这周做了什么,下周还要做什么? 除了发言人和项目经理外,每个人都会觉得无聊. 这种会议是在拖项目的后腿,赶紧停 ...
- 飘逸的python - 理解打开文件的模式
当我们用open()函数去打开文件的时候,有好几种打开的模式. 'r'->只读 'w'->只写,文件已存在则清空,不存在则创建. 'a'->追加,写到文件末尾 'b'->二 ...
- hibernate 使用C3P0数据源
1.导入jar包: hibernate-release-4.3.5.Final/lib/optional/*.jar 2.增加配置: <!-- 配置 C3P0 数据源 --> <pr ...
- [Practical Git] Show who changed a line last with git blame
When working on a file, we often want to know who made certain changes last; we can use git blame to ...
- innobackupex --slave-info参数的含义和适用场景
http://blog.itpub.net/28916011/viewspace-1969135/ 我有个问题一直没弄明白,就是innobackupex里面的--slave-info这个参 ...