什么是“小于点”符号意味着在Chrome控制台输出? [英] What's the "less than dot" symbol mean in Chrome console output?

查看:183
本文介绍了什么是“小于点”符号意味着在Chrome控制台输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时候,但并不总是,当Chrome JavaScript控制台中的评估结果为未定义时,左边距中会出现一个符号,该符号看起来像带点的小于符号。

Sometimes, but not always, when the result of an evaluation in the Chrome JavaScript console results in "undefined", there is a symbol in the left margin that looks like a less-than symbol with a dot.

示例可以在 Chrome开发人员的工具文档

但是这个符号意味着什么都没有解释。有谁知道它试图传达什么?感谢。

But what that symbol means does not appear to ever be explained. Does anybody know what it's trying to convey? Thanks.

推荐答案

每当一组函数在命令行运行时,控制台输出的最后一行总是返回值在输入中的最后一个操作。当自命令执行开始以来有控制台输出时,该符号调用函数的返回值。这是为了避免在这种情况下的混乱:

Whenever a set of function runs on the command line, the last line of console output is always the returned value of the last operation in the input. The symbol calls out the return value of a function when there has been console output since the start of the command execution. This is to avoid confusion in a case like this:

function logVar(someVar) {
    console.log(someVar);
}

当您运行 logVar 在控制台上,它输出 someVar 的值。但是,还会记录 logVar 的返回值(此处为 undefined )。这有助于让返回值与记录的变量在视觉上区分开来,所以你不要看输出的最后一行,并且奇迹,为什么我的变量 undefined ? 。

When you run logVar on the console, it outputs the value of someVar. However, the return value of logVar is also logged (here, undefined). It's helpful to have the return value visually distinguished from the logged variable, so you don't look at the last line of the output and wonder, "Why is my variable undefined?".

这篇关于什么是“小于点”符号意味着在Chrome控制台输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆