// 面试题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. C#- 实用的Log4Net日志记录例子

    工作中也是要用到日志记录的,LOG4NET在这块做的不错,以后可以继续拿来用. 1.引用DLL 2.LOG4NET的配置文件 <?xml version="1.0" enco ...

  2. iOS7 人机界面设计指南

    iOS7 人机界面设计指南     苹果在WWDC 2013大会上发布了iOS 7,新系统一改5年来的拟物路线,在乔纳森•艾维的主导下,加入了更多的“扁平化”和“极简”现代设计元素. iOS7系统界面 ...

  3. (JAVA版)冒泡排序

    核心代码: public void bubbleSort(){ ;i<length-;i++){ ;j<length-i-;j++){ ]) swap(j,j+); } } } publi ...

  4. java反射快速入门(一)

    本文会从以下几个方面讲起 ① 反射的简单解释 ② java反射的API接口 及 demo ③ 反射的优缺点.应用场景 一.什么是反射? java反射:在程序运行中动态获取类的信息,及动态调用对象的方法 ...

  5. DBHelper数据库操作类(二)

    不错文章:http://www.codefans.net/articles/562.shtml http://www.cnblogs.com/gaobing/p/3878342.html using ...

  6. 对PostgreSQL xmax的理解

    xmax The identity (transaction ID) of the deleting transaction, or zero for an undeleted row version ...

  7. SCO连接SCOM报警

    当SCOM中出现红色警报时,在目标计算机上运行一个程序: 1.新建Runbook,添加一个Monitor Alert 2.设置Monitor Alert属性,选择connection,设置警报过滤条件 ...

  8. Start-Process传递变量

    如果$b="aa,bb" Start-Process PowerShell.exe -Argumentlist "d:\w.ps1 $a $b $c" Star ...

  9. [RxJS] ReplaySubject

    A ReplaySubject caches its values and re-emits them to any Observer that subscrubes late to it. Unli ...

  10. android EditText输入变化事件详解

    editText.addTextChangedListener(new TextWatcher(){ public void afterTextChanged(Editable s) {    // ...