Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does logging an empty string variable in Edge return an object

I am running the following script on Edge's, Firefox's, and Chrome's console:

var test=''; console.log(test);

On both Firefox and Chrome, I get an empty string. On Edge, however, I get the following:

{
    "notifyType": "consoleItemLog",
    "message": {
        "message": "",
        "styles": "",
        "hasFormatString": true,
        "fileUrl": "eval code (1)",
        "lineNumber": 1,
        "columnNumber": 14
    }
} 

I am able to confirm this on two computers with Edge. Can someone tell me why this is happening and what does it mean?

like image 629
Kristianne Nerona Avatar asked Apr 06 '18 06:04

Kristianne Nerona


People also ask

Why is empty string false?

Truthy or Falsy When javascript is expecting a boolean and it's given something else, it decides whether the something else is “truthy” or “falsy”. An empty string ( '' ), the number 0 , null , NaN , a boolean false , and undefined variables are all “falsy”. Everything else is “truthy”.

Does empty string return false?

Yes. All false , 0 , empty strings '' and "" , NaN , undefined , and null are always evaluated as false ; everything else is true .

How does empty string work?

An empty string is a string instance of zero length, whereas a null string has no value at all. An empty string is represented as "" . It is a character sequence of zero characters. A null string is represented by null .

What does empty string evaluate to?

An empty string is a String object with an assigned value, but its length is equal to zero. A null string has no value at all.


1 Answers

This has been fixed in response to your bug report. It says "Fixed in build # 17.17681", which means the fix will ship with Windows 10 RS5 (17681 is an internal build; the closest Insider build, 17682, may or may not contain the fix, and it's nearly a month old as of this writing anyway).

like image 169
BoltClock Avatar answered Oct 23 '22 13:10

BoltClock