比如:
const test = '123'; const typeIs = data => { console.log(); return toString.call(data).replace(/object|[|]|s/g, '').toLowerCase(); }; typeIs(test);
应该在console.log里面怎么写,才能打印出传入typeIs这个函数的实参名字:'test'
console.log
typeIs
'test'
不能。
JS 里没有类似反射的机制来获取执行上下文。
2.1m questions
2.1m answers
63 comments
56.7k users