// 面试题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的更多相关文章

随机推荐

  1. 【Away3D代码解读】(五):动画模块及骨骼动画

    动画模块核心存放在away3d.animators包里: Away3D支持下面几种动画格式: VertexAnimator:顶点动画 SkeletonAnimator:骨骼动画 UVAnimator: ...

  2. 利用putty软件连接虚拟机中linux操作系统

    http://jingyan.baidu.com/article/9c69d48fbefe6613c8024e6a.html 大家在使用虚拟的过程中有时候会感觉切换操作系统很不方便,那么有什么方法可以 ...

  3. cocos2dx 运动+旋转动画 CCSequence CCAnimation CCAnimate CCMoveTo CCCallFuncN

    cocos2dx 动画是个非常奇妙的东西~~. 这里看到的是一个物体,在运动的过程中会不断地翻转的过程. 两个动画一起来~~ 以下的代码中涉及到:CCAnimation(补间动画 )  CCAnima ...

  4. PHP函数ip2long转换IP时数值太大产生负数的解决办法

    有两种办法: 1. bindec( decbin($long))  利用bindec和decbin两个函数转换一次就没有问题了 我一直在用上面的方法,但是在升级到PHP7以后就不起作用了(因为最近只进 ...

  5. 【项目经验】如何用TexturePacker & Physicseditor开发游戏

    首先感谢Andreas的license.先广告一下Andreas. ------------------------------------------------------------------ ...

  6. unity3d NGUI多场景共用界面制作

    1创建单独编辑UI的unity场景 UIScene.unity 用来做UI面界 ,创建Resources文件存放UI界面的prefab,代码里动态load资源仅仅能从Resources目录载入 2创建 ...

  7. 如何使用MVP模式搭建我们的Android应用?

    听到很多人在讨论MVVM,我自己早些时候也写过一篇介绍MVVM的文章(玩转Android之MVVM开发模式实战,炫酷的DataBinding!),实际上,在Android开发领域中,除了MVVM之外, ...

  8. ios运行某些工程时屏幕上下出现黑边的解决办法

    今天准备了解下MVVM设计模式,于是就从GitHub上Down了一个MVVM的demo(地址在这)学习,下载之后,在模拟器上运行一下,出现如下图上下有黑边,以前也遇到过这个问题,但当时没有记录,现在还 ...

  9. Xcode常用快捷键总结

    Xcode常用快捷键 Xcode窗口快捷键 其他补充: 编译代码: command + B 将代码翻译为计算机能够识别的语言(0/1) 调试Xcode中程序: command + R 折叠与展开方法代 ...

  10. Android 自学之星级评分条RatingBar

    星级评分条(RatingBar)与拖动条十分相似,他们还有共同的父类AbsSeekBar.实际上星级评分条和拖动条的用法和功能都十分的接近:他们都允许用户通过拖动来改变进度.RatingBar与See ...