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的更多相关文章
随机推荐
- 总结一下ERP .NET程序员必须掌握的.NET技术
总结一下ERP .NET程序员必须掌握的.NET技术,掌握了这些技术工作起来才得心应手 从毕业做.NET到现在,有好几年了,自认为只能是达到熟练的水平,谈不上精通.所以,总结一下,自己到底熟练掌握 ...
- sql2008_x64 读取excel
sql2008_x64 读取excel 下载64bit 版的AccessDatabaseEngine_x64:http://www.microsoft.com/en-us/download/detai ...
- jquery ajax 报交请求返回 HTTP 400 错误
提交请求的AJAX代码如下: 点击(此处)折叠或打开 $.ajax({ url: "${ctx}/selfhelp/userAttributeAnalysis/userAttributeLi ...
- Hibernate级联操作 注解
EJB3 支持的操作类型 /** * Cascade types (can override default EJB3 cascades */ public enum CascadeType { AL ...
- leetcode解决问题的方法||Integer to Roman问题
problem: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range ...
- Libgdx Box2D真实---这缓释微丸(三:规则经常使用body和精灵联合)
介绍规则body怎样和图片结合.上一篇文章我介绍了box2D的基本知识,假设你用心的话.你会搜索网上相关简单demo吧.那些我就不写了.那么假设我用图片表示我的那个body.而不是简单线条.那该怎么办 ...
- C 高级编程5 IO与文件权限
三.基于文件的描术符号 .得到文件描术符号/释入文件描术符号 a.文件类型 目录文件 d 普通文件 f 字符设务文件 c 块设备文件 b 软连接文件 l 管道文件 p socket文件 s 字符设备文 ...
- 文件和目录之link、unlink、remove和rename函数
任何一个文件可以有多个目录项指向其i节点.创建一个指向现有文件的链接的方法是使用link函数. #include <unistd.h> int link( const char *exis ...
- C#_wpf_userinput_数据绑定_后台对象改变,界面数据也变化
<!--MainWindow.xaml--> <Window x:Class="UserStore.MainWindow" xmlns="http:// ...
- java专业规划(转载)
1. Java语言基础 谈到Java语言基础学习的书籍,大家肯定会推荐Bruce Eckel的<Thinking in Java>.它是一本写的相当深刻的技术书籍,Java语言基础 ...