Edgeの空文字のconsole.logが空じゃない
2425 ワード
Edge以外のconsole.log("")は
javascriptのconsole.logで空文字を入れた時ってどう見えるかって、普通はこう見える事を期待する。
※左からChrome、IE11
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で見てみると……
なにこれ
※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怖い
Author And Source
この問題について(Edgeの空文字のconsole.logが空じゃない), 我々は、より多くの情報をここで見つけました https://qiita.com/SARU_KABUTO/items/ba4c53367144cfef3989著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .