console.log & front-end jobs

bind & function

let log = console.log;
let obj = {}; log(obj);
log(typeof Function.prototype.bind);
log(typeof Function.prototype.bind());
log(Function.prototype.bind.name);
log(Function.prototype.bind().name);
//{}
//function
//function
//bind
//bound Function.prototype;
//ƒ () { [native code] }
Function.prototype.bind;
//ƒ bind() { [native code] }
Function.prototype.bind();
//ƒ () { [native code] }
Function.prototype.bind.name;
//"bind"
Function.prototype.bind().name;
// "bound "

https://zhuanlan.zhihu.com/p/50539121

vanilla js customize bind this

"use strict";

/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
* @created 2019-08-31
* @modified
*
* @description vanilla js customize bind this
* @augments
* @example
* @link
*
*/ let log = console.log; let obj = {
x: 42,
getX: function() {
log(`this =`, this);
log(`obj.x =`, obj.x);
return this.x;
}
}; // The function gets invoked at the global scope
let unboundGetX = obj.getX;
// log(unboundGetX());
// undefined let boundGetX = unboundGetX.bind(obj);
// log(boundGetX());
// 42 Function.prototype.customizeBind = function() {
let func = this;
let _this = arguments[0];
// arguments is array-like, not an array!
// let args = Array.prototype.slice.apply(arguments,[1]);
let args = [...arguments].slice(1);
// log(`func =`, func);
// log(`_this =`, _this);
// log(`args =`, args);
if (typeof func === "function") {
return function() {
let allArgs = args.concat([...arguments].slice(0));
// log(`allArgs =`, allArgs);
return func.apply(_this, allArgs);
};
} else {
throw new Error(`Function.prototype.customizeBind - what is you trying to be bound is not callable!`);
}
}; let customizeBoundGetX = unboundGetX.customizeBind(obj);
log(customizeBoundGetX());

ASCII text art


console.log(`%c
_____ _______ _____ _____ _____ _____
______ /\ \ /::\ \ /\ \ /\ \ /\ \ /\ \
|::| | /::\ \ /::::\ \ /::\ \ /::\ \ /::\____\ /::\ \
|::| | /::::\ \ /::::::\ \ /::::\ \ /::::\ \ /::::| | /::::\ \
|::| | /::::::\ \ /::::::::\ \ /::::::\ \ /::::::\ \ /:::::| | /::::::\ \
|::| | /:::/\:::\ \ /:::/~~\:::\ \ /:::/\:::\ \ /:::/\:::\ \ /::::::| | /:::/\:::\ \
|::| | /:::/ \:::\ \ /:::/ \:::\ \ /:::/__\:::\ \ /:::/__\:::\ \ /:::/|::| | /:::/__\:::\ \
|::| | /:::/ \:::\ \ /:::/ / \:::\ \ /::::\ \:::\ \ /::::\ \:::\ \ /:::/ |::| | \:::\ \:::\ \
|::| | /:::/ / \:::\ \ /:::/____/ \:::\____\ /::::::\ \:::\ \ /::::::\ \:::\ \ /:::/ |::|___|______ ___\:::\ \:::\ \
______|::|___|___ ____ /:::/ / \:::\ ___\ |:::| | |:::| | /:::/\:::\ \:::\ \ /:::/\:::\ \:::\____\ /:::/ |::::::::\ \ /\ \:::\ \:::\ \
|:::::::::::::::::| |/:::/____/ ___\:::| ||:::|____| |:::|____|/:::/ \:::\ \:::\____\/:::/ \:::\ \:::| |/:::/ |:::::::::\____\/::\ \:::\ \:::\____\
|:::::::::::::::::|____|\:::\ \ /\ /:::|____| \:::\ _\___/:::/ / \::/ \:::\ \::/ /\::/ |::::\ /:::|____|\::/ / ~~~~~/:::/ /\:::\ \:::\ \::/ /
~~~~~~|::|~~~|~~~ \:::\ /::\ \::/ / \:::\ |::| /:::/ / \/____/ \:::\ \/____/ \/____|:::::\/:::/ / \/____/ /:::/ / \:::\ \:::\ \/____/
|::| | \:::\ \:::\ \/____/ \:::\|::|/:::/ / \:::\ \ |:::::::::/ / /:::/ / \:::\ \:::\ \
|::| | \:::\ \:::\____\ \::::::::::/ / \:::\____\ |::|\::::/ / /:::/ / \:::\ \:::\____\
|::| | \:::\ /:::/ / \::::::::/ / \::/ / |::| \::/____/ /:::/ / \:::\ /:::/ /
|::| | \:::\/:::/ / \::::::/ / \/____/ |::| ~| /:::/ / \:::\/:::/ /
|::| | \::::::/ / \::::/____/ |::| | /:::/ / \::::::/ /
|::| | \::::/ / |::| | \::| | /:::/ / \::::/ /
|::|___| \::/____/ |::|____| \:| | \::/ / \::/ /
~~ ~~ \|___| \/____/ \/____/ `, `color: #0f0; background: #000;`);

http://patorjk.com/software/taag/#p=display&h=0&v=0&f=Alpha&t=xgqfrms

refs

http://www.alloyteam.com/2020/01/14184/#prettyPhoto

    //Alloyteam 招聘广告
window.console && console.log && console.log("\n"+" _ _ _ _____ \n \/_\\ | || | ___ _ _ \/__ \\ ___ __ _ _ __ ___ \n \/\/_\\\\ | || | \/ _ \\ | | | | \/ \/\\\/ \/ _ \\ \/ _` || '_ ` _ \\ \n\/ _ \\| || || (_) || |_| | \/ \/ | __\/| (_| || | | | | |\n\\_\/ \\_\/|_||_| \\___\/ \\__, | \\\/ \\___| \\__,_||_| |_| |_|\n |___\/\n\n 欢迎加入AlloyTeam:请将简历(邮件标题后面再加上'from console')发送至 %c Kinvix@QQ.com \n", "color:red");


xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


console.log & front-end jobs的更多相关文章

  1. [AST Babel Plugin] Transform code, add line:column number for console log

    For example we have current code: function add(a, b) { console.log(a, b) return a + b } function sub ...

  2. const let,console.log('a',a)跟console.log('a'+a)的区别

    const 创建一个只读的常量 let块级作用域 const let重复赋值都会报错 console.log('a',a) a console.log('a'+a) a2 逗号的值会有空格:用加号的值 ...

  3. console.log("A"-"B"+"3")=?

    (点击上方的订阅号,可快速关注,关注有惊喜哦^_^) 前不久看到一道JS基础题目,做了一下竟然错了一半...在此分享一下: 先把题目放上来,大家可以自己测试一下再看答案哦^_^ ①console.lo ...

  4. javascript的console.log用法

    f1.html代码 <iframe id="frame2" name="frame1" src="ww.html"></i ...

  5. alert()与console.log()的区别

    [1]alert() [1.1]有阻塞作用,不点击确定,后续代码无法继续执行 [1.2]alert()只能输出string,如果alert输出的是对象会自动调用toString()方法 e.g. al ...

  6. console.log((function f(n){return ((n > 1) ? n * f(n-1) : n)})(5))调用解析

    console.log((function f(n){) ? n * f(n-) : n)})()); 5被传入到函数,函数内部三元计算,5 > 1成立,运算结果是5*f(4),二次运算,5*4 ...

  7. JS高级群的日常!写一个从10到0的倒计时,用console.log打印,不可以用 setInterval!本来说好的研究avalonJS最后演变成了看着大神在那边互相比拼实力。。

      JS高级群的日常!写一个从10到0的倒计时,用console.log打印,不可以用 setInterval!本来说好的研究avalonJS最后演变成了看着大神在那边互相比拼实力..   小森执行一 ...

  8. console.dir() 与 console.log() 区别

    Difference console.log prints the element in an HTML-like tree console.dir prints the element in a J ...

  9. 简述alert和console.log的区别

    生活中还是得有发现美好和差别的眼睛~~ 学习前端那么久既然还不知道alert和console.log的差别~~~~ 蓝瘦,香菇~~~ 本菜鸟一直以为alert和console.log其实是一样的用法, ...

随机推荐

  1. linux系统层面调优

    linux系统层面调优和常见的面试题 - 云+社区 - 腾讯云 https://cloud.tencent.com/developer/article/1664287

  2. 3分钟搞懂什么是WPF。

    先推荐下猛哥(刘铁猛)的书籍  <深入浅出WPF>. 一直以来,完美的用户体验是桌面应用程序和Web应用程序中的一大障碍.许多开发人员绞尽脑汁将界面设计得美观炫丽些.互 动感强些,但费了九 ...

  3. ResponseEntity和@ResponseBody以及@ResponseStatus区别

    看的迷迷糊糊的 https://www.jdon.com/springboot/responseentity.html

  4. 知道 Redis-Cluster 么?说说其中可能不可用的情况

    Redis 集群模式简述 一个集群模式的官方推荐最小最佳实践方案是 6 个节点,3 个 Master 3 个 Slave 的模式,如 图00 所示. key 分槽与转发机制 Redis 将键空间分为了 ...

  5. linux git 命了

    #拉取远程分支代码到本地git clone -b 分支名称 sshGit路径 #更新远程代码到本地git pull #提交本地修改的代码到本地仓库git commit -m "自动打包&qu ...

  6. acid解释

    原子性A:一个事务内部的所有操作都是不可分割的,这叫原子性.一致性C:事务内部的所有操作要么都成功,要么都失败.隔离性I:事务与事务之间永远不相见.持久性D:就是说数据最终是落到磁盘永久保存的.

  7. Pytest(12)pytest缓存

    前言 pytest 运行完用例之后会生成一个 .pytest_cache 的缓存文件夹,用于记录用例的ids和上一次失败的用例. 方便我们在运行用例的时候加上--lf 和 --ff 参数,快速运行上一 ...

  8. 解决 error MSB4057: 该项目中不存在目标“_CopyWebApplication” 问题

    在使用MSBuild 编译项目的时候报错: 解决办法: 在Web项目中,使用Nuget添加引用  MSBuild.Microsoft.VisualStudio.Web.targets 即可.

  9. 回文树(回文自动机PAM)小结

    回文树学习博客:lwfcgz    poursoul 边写边更新,大概会把回文树总结在一个博客里吧... 回文树的功能 假设我们有一个串S,S下标从0开始,则回文树能做到如下几点: 1.求串S前缀0~ ...

  10. P1108 低价购买(DP)

    题目描述 "低价购买"这条建议是在奶牛股票市场取得成功的一半规则.要想被认为是伟大的投资者,你必须遵循以下的问题建议:"低价购买:再低价购买".每次你购买一支股 ...