简体   繁体   English

为什么firebug会显示一些红色的javascript对象?

[英]Why firebug shows some javascript objects in red color?

I am trying to learn and improve my javascript skills. 我正在努力学习和提高我的javascript技能。

A very helpful tool is firebug, with which i can inspect different javascript objects. 一个非常有用的工具是firebug,我可以用它来检查不同的javascript对象。

However, i have some questions: 但是,我有一些问题:

  1. Some object names (like jQuery, $, fn etc.) are displayed in red color. 一些对象名称(如jQuery,$,fn等)以红色显示。 Why? 为什么?

  2. Some other objects has a "prototype" property, which is not in bold. 其他一些对象有一个“原型”属性,不是粗体。 What is that and when is good or not to use/implement it? 那是什么以及何时使用/实施它是好还是不好?

  3. Most of functions are shown as "function()". 大多数功能显示为“function()”。 But there are also some other functions which are displayed, for example, as "u(M)", "z()", "B(E)". 但是也有一些其他功能被显示,例如,“u(M)”,“z()”,“B(E)”。 Why they are different? 为什么他们不同?

Firebug控制台

Thank you 谢谢

from the documentation page of firebug: 来自firebug的文档页面

Different color codes let you distinguish between the different types of variables and improve readability. 使用不同的颜色代码可以区分不同类型的变量并提高可读性。 Here they are in detail: 他们在这里详细说明:

Format        Description
Bold Black    Objects
Black         DOM objects
get in gray   "Getter" functions
Bold green    User functions
Green         DOM functions
Bold Red      Constructor functions 

Hope this helps 希望这可以帮助

您可能想看一下FirebugWiki

 Bold Red are constructor functions 

The 'prototype' property is a built-in feature that links to the structure of the object. 'prototype'属性是一个内置功能,可链接到对象的结构。 In JS everything is an object, even functions, and by accessing the prototype property you can extend the object. 在JS中,一切都是对象,甚至是函数,通过访问prototype属性,您可以扩展对象。

How does JavaScript .prototype work? JavaScript .prototype如何工作?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM