Help us understand the problem. What is going on with this article?

Edgeの空文字のconsole.logが空じゃない

More than 1 year has passed since last update.

Edge以外のconsole.log("")は

javascriptのconsole.logで空文字を入れた時ってどう見えるかって、普通はこう見える事を期待する。
※左からChrome、IE11
chromeie.PNG

console_test.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script>
  console.log("empty↓");
  console.log("");
</script>
</body>
</html>

Edgeのconsole.log("")は

でもEdgeで見てみると……
なにこれ
edge.PNG
※Cドライブの直下に置けばよかった……
なにこれ

{"notifyType":"consoleItemLog","message":{"message":"","styles":"","hasFormatString":true,"fileUrl":"console_test.html","lineNumber":9,"columnNumber":3}}

空文字チェックは効く(==""はtrueになる)のでそこまで問題ではないとは思うが、空と思ってこれが出てきたらびっくりするな……
日本語では誰も書いていなかったので記事にした。
StackOverFlowでは既に投稿されてた
https://stackoverflow.com/questions/49686857/why-does-logging-an-empty-string-variable-in-edge-return-an-object

結論

Edge怖い

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away