SOURCE

console 命令行工具 X clear

                    
>
console
// function isArray(value){
//     console.log(Object.prototype.toString.call(value));//[object Array]
//     return Object.prototype.toString.call(value) == "[object Array]";
// }
// console.log(isArray([]));//true

// function isFunction(value){
//     return {}.toString.call(value) == "[object Function]";
// }
// function isRegExp(value){
//     return {}.toString.call(value) == "[object RegExp]";
// }
// console.log(isFunction(()=>{}));//true
// console.log(isRegExp(/1/));//true


// function isJSON(value){
//     return window.JSON&&{}.toString.call(value) == "[object JSON]";
// }


// function Person(name,job,age){
//     if(this instanceof Person){
//         this.name = name;
//         this.job = job;
//         this.age = age;
//     }else{
//         return new Person(name,job,age);
//     }
    
// }
// var p = Person("周子越","学生","20");
// console.log(p.age);//20
// console.log(age);//Uncaught ReferenceError: age is not defined

// var flag = "a";
// var a = 0;
// var b = 0;
// var lazyLoadFuuc = (function(){
//     if(flag == "a"){
//         lazyLoadFunc = function(){
//             a++;
//         }
//     }else{
//         lazyLoadFunc = function(){
//             b++;
//         }
//     }
// })();
// lazyLoadFunc();
// console.log(lazyLoadFunc)// function(){ a++; }
// lazyLoadFunc();
// console.log(a);//2
// console.log(b);//0

// function bind(fn,context){
//     return function(){
//         return fn.apply(context,arguments);
//     }
// }
// var obj = {
//     value:"local",
//     speak:function(){
//         console.log(value)
//     }
// }
// var value = "global";
// var newFunc = bind(obj.speak,this);
// newFunc();//global

// function curry(func){
//     var args = [].slice.call(arguments,1);
//     return function(){
//         var innerArgs = [].slice.call(arguments);
//         var finalArgs = args.concat(innerArgs);
//         return func.apply(null,finalArgs);
//     } 
// }
// function add(num1,num2){
//     return num1 + num2;
// }
// var curriedAdd = curry(add,5);
// console.log(curriedAdd(5));//10

// function setInterval(callback,interval){
//     setTimeout(function(){
//         callback();
//         setTimeout(arguments.callee,interval);
//     },interval);
// }
// setInterval(function(){
//     console.log(new Date())
// },1000)

// function chunk(array,process,context,timeout){
//     setTimeout(function(){
//         var item = array.shift();
//         process.call(context,item);
//         if(array.length>0){
//             setTimeout(arguments.callee,timeout);
//         }
//     },timeout);
// }
// chunk([1,2,3,4,5,6,7,8,9],function(value){
//     console.log(value);
// },this,100);

// function throttle(method,context,timeout){
//     clearTimeout(method.tId);
//     method.tId = setTimeout(function(){
//         method.call(context);
//     },timeout);
// }

// function clk(){
//     // throttle(function(){
//     //     console.log("clicked");
//     // },this,100)
//     console.log("clicked");
// }
// throttle(function(){
//         console.log("clicked");
//     },this,1000)

// function getElement(id){
//     if(typeof document.getElementById == "function" ){
//         return document.getElementById(id);
//         }
//     else{
//         return document.all[id];
//         }
// }

// // 不够具体
// var isFirefox = !!(navigator.vendor && navigator.vendorSub);
// // 假设过头
// var isIE = !!(document.getElementById && document.createElement && document.getElementsByTagName);

// // 检测是否支持NetScape风格的插件
// var hasNSPlugins = !!(navigator.plugins && navigator.plugins.length);
// // 确定浏览器是否具有DOM1级规定的能力
// var hasDOM1 = !!(document.getElementById && document.createElement && document.getElementsByTagName);

// var hasDontEnumQuirk = function(){
//     var o = {toString : function(){}};
//     for(var prop in o){
//         if(prop == "toString"){
//             return false;
//         }
//     }
//     return true;
// }();
// console.log(hasDontEnumQuirk);

// var hasEnumShadowsQuirk = function(){
//     var o = {toString : function(){}};
//     var count = 0;
//     for(var prop in o){
//         if(prop == "toString"){
//             count++;
//         }
//     }
//     return count>1;
// }();

// console.log(hasEnumShadowsQuirk);


// var isUnique = function(astr) {
//     if(!astr) return true;
//     let arr = astr.split("");
//     arr.sort();
//     console.log(arr);
//     for(let i = 1;i<arr.length;i++){
//         if(arr[i] == arr[i-1]) return false;
//     }
//     return true;
// };

// console.log(isUnique("kzwunahkiz"))
// var missingNumber = function(nums) {
//     if(nums.length == 1){
//         console.log("a");
//         if(nums[0] == 0) return 1;
//         else return 0;
//     }
//     nums = nums.sort((a, b) => a - b < 0 ? -1 : 1);
//     console.log(nums);
//     for(let i = 0;i<nums.length;i++){
//         if(nums[i] != i) return i
//     }
//     return nums[nums.length-1]+1;
// };
// let test_arr =[45,35,38,13,12,23,48,15,44,21,43,26,6,37,1,19,22,3,11,32,4,16,28,49,29,36,33,8,9,39,46,17,41,7,2,5,27,20,40,34,30,25,47,0,31,42,24,10,14];
// console.log(missingNumber(test_arr));




console.log((-11).toString(2));

function no_plus_add(a,b){
    A = a.toString(2);
    B = b.toString(2);
    let flag = true;//true是正数
}
function get_flag(a,b){
    A = a.toString();
    B = b.toString();
    if(A.indexOf("-")==-1){
        //A是负数
        if(B.indexOf("-")==-1){
            //B是负数
        }else{

        }
    }else{
        //A是正数
        if(B.indexOf("-")==-1){
            //B是负数
        }else{

        }
    }
}
<canvas id="drawing" width="500" height="500">
NOT support canvas
</canvas>
<script>
    var drawing = document.getElementById("drawing");
    if(drawing.getContext){//检测是否支持canvas
        var context = drawing.getContext("2d");
        var gradient = context.createLinearGradient(30,30,70,70);
        gradient.addColorStop(0,"white");
        gradient.addColorStop(1,"black");
        context.fillStyle = gradient;
        context.fillRect(30,30,50,50)
    }
</script>