Using underscore.js in chrome console

柔情痞子 提交于 2019-12-11 17:32:19

问题


I am learning JavaScript and came to a point wherein I have to load underscore.js in the chrome console. I did some search and ended at this stackflow response: How to enable to use underscore in console in Chrome developer tool?

The code snippet provided in the above link works for me. But I could not figure out what does window.R object refer to? Why do I need to include this? Can't I just add the script element and load the underscorejs?

I am referring the below piece of code in the stackoverflow response provided. thanks!

(function () {
  if (typeof window.R === 'undefined') {    
    var s = document.createElement('script');
    s.type = 'text/javascript';
    s.src = 'https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js';
    document.head.appendChild(s);
    }
}());

来源:https://stackoverflow.com/questions/51926317/using-underscore-js-in-chrome-console

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!