Object.entries is not a function in NWJS 0.36.3 (Node 11.10.1) The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceHow to append to a file in Node?In Node.js, how do I “include” functions from my other files?How to uninstall npm modules in node js?map function for objects (instead of arrays)Cannot install packages using node package manager in Ubuntunode how to create a directory if doesn't exist?nvm keeps “forgetting” node in new terminal sessionlodash Type Error has no function findKey()How to include node-sass in nwjs (on windows)nwjs migrating from 0.12 to 10.18

When did F become S in typeography, and why?

Can smartphones with the same camera sensor have different image quality?

University's motivation for having tenure-track positions

system() function string length limit

Would an alien lifeform be able to achieve space travel if lacking in vision?

How do you keep chess fun when your opponent constantly beats you?

How should I replace vector<uint8_t>::const_iterator in an API?

How to delete random line from file using Unix command?

Are my PIs rude or am I just being too sensitive?

How did passengers keep warm on sail ships?

Windows 10: How to Lock (not sleep) laptop on lid close?

Typeface like Times New Roman but with "tied" percent sign

Does Parliament hold absolute power in the UK?

Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?

I could not break this equation. Please help me

What was the last x86 CPU that did not have the x87 floating-point unit built in?

How are presidential pardons supposed to be used?

Sort a list of pairs representing an acyclic, partial automorphism

How can I define good in a religion that claims no moral authority?

How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time

How does this infinite series simplify to an integral?

"... to apply for a visa" or "... and applied for a visa"?

What is this lever in Argentinian toilets?

Who or what is the being for whom Being is a question for Heidegger?



Object.entries is not a function in NWJS 0.36.3 (Node 11.10.1)



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceHow to append to a file in Node?In Node.js, how do I “include” functions from my other files?How to uninstall npm modules in node js?map function for objects (instead of arrays)Cannot install packages using node package manager in Ubuntunode how to create a directory if doesn't exist?nvm keeps “forgetting” node in new terminal sessionlodash Type Error has no function findKey()How to include node-sass in nwjs (on windows)nwjs migrating from 0.12 to 10.18



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am trying to create a function that swaps 'keys' with 'values' in an Object. For some reason, I'm getting a TypeError: object.entries is not a function. What am I missing or doing wrong here?



Object.defineProperty(Object.prototype, 'swapKeysValues', 
value: function()
let obj = ;
this.entries().forEach(([key, value]) =>
obj[value] = key;
);
return obj;

);



Further testing reveals:



let foo = a: 1, b: 2, c: 3 
typeof foo // "object"
foo instanceof Object // true
foo.entries // undefined
foo.entries() // Uncaught TypeError: foo.entries is not a function



Update:



So what I learned is that objects (i.e. let foo = a: 1 ) do not inherit the .entries, .keys, or .values functions as properties, and I must access those functions by calling Object.entries(foo) as pointed out by tehhowch / SylvainF. Working code:



Object.defineProperty(Object.prototype, 'swapKeysValues', 
value: function()
let obj = ;
Object.entries(this).forEach(([key, value]) =>
obj[value] = key;
);
return obj;

);

// Example
let foo = a: 1, b: 2, c: 3
foo.swapKeysValues()

// Output
1: "a", 2: "b", 3: "c"



Thank you tehhowch / SylvainF!










share|improve this question



















  • 1





    If you create a function with the keyword function, this will refer to the function itself. There is no entries method defined in your function.

    – Seblor
    Mar 8 at 13:37







  • 1





    Object.entries(someObj).

    – tehhowch
    Mar 8 at 13:39











  • I don't understand, considering I'm running the above 'foo' test code in the developer tools console. Same result in Chrome 72 browser.

    – caffeinatedbits
    Mar 8 at 13:46

















0















I am trying to create a function that swaps 'keys' with 'values' in an Object. For some reason, I'm getting a TypeError: object.entries is not a function. What am I missing or doing wrong here?



Object.defineProperty(Object.prototype, 'swapKeysValues', 
value: function()
let obj = ;
this.entries().forEach(([key, value]) =>
obj[value] = key;
);
return obj;

);



Further testing reveals:



let foo = a: 1, b: 2, c: 3 
typeof foo // "object"
foo instanceof Object // true
foo.entries // undefined
foo.entries() // Uncaught TypeError: foo.entries is not a function



Update:



So what I learned is that objects (i.e. let foo = a: 1 ) do not inherit the .entries, .keys, or .values functions as properties, and I must access those functions by calling Object.entries(foo) as pointed out by tehhowch / SylvainF. Working code:



Object.defineProperty(Object.prototype, 'swapKeysValues', 
value: function()
let obj = ;
Object.entries(this).forEach(([key, value]) =>
obj[value] = key;
);
return obj;

);

// Example
let foo = a: 1, b: 2, c: 3
foo.swapKeysValues()

// Output
1: "a", 2: "b", 3: "c"



Thank you tehhowch / SylvainF!










share|improve this question



















  • 1





    If you create a function with the keyword function, this will refer to the function itself. There is no entries method defined in your function.

    – Seblor
    Mar 8 at 13:37







  • 1





    Object.entries(someObj).

    – tehhowch
    Mar 8 at 13:39











  • I don't understand, considering I'm running the above 'foo' test code in the developer tools console. Same result in Chrome 72 browser.

    – caffeinatedbits
    Mar 8 at 13:46













0












0








0








I am trying to create a function that swaps 'keys' with 'values' in an Object. For some reason, I'm getting a TypeError: object.entries is not a function. What am I missing or doing wrong here?



Object.defineProperty(Object.prototype, 'swapKeysValues', 
value: function()
let obj = ;
this.entries().forEach(([key, value]) =>
obj[value] = key;
);
return obj;

);



Further testing reveals:



let foo = a: 1, b: 2, c: 3 
typeof foo // "object"
foo instanceof Object // true
foo.entries // undefined
foo.entries() // Uncaught TypeError: foo.entries is not a function



Update:



So what I learned is that objects (i.e. let foo = a: 1 ) do not inherit the .entries, .keys, or .values functions as properties, and I must access those functions by calling Object.entries(foo) as pointed out by tehhowch / SylvainF. Working code:



Object.defineProperty(Object.prototype, 'swapKeysValues', 
value: function()
let obj = ;
Object.entries(this).forEach(([key, value]) =>
obj[value] = key;
);
return obj;

);

// Example
let foo = a: 1, b: 2, c: 3
foo.swapKeysValues()

// Output
1: "a", 2: "b", 3: "c"



Thank you tehhowch / SylvainF!










share|improve this question
















I am trying to create a function that swaps 'keys' with 'values' in an Object. For some reason, I'm getting a TypeError: object.entries is not a function. What am I missing or doing wrong here?



Object.defineProperty(Object.prototype, 'swapKeysValues', 
value: function()
let obj = ;
this.entries().forEach(([key, value]) =>
obj[value] = key;
);
return obj;

);



Further testing reveals:



let foo = a: 1, b: 2, c: 3 
typeof foo // "object"
foo instanceof Object // true
foo.entries // undefined
foo.entries() // Uncaught TypeError: foo.entries is not a function



Update:



So what I learned is that objects (i.e. let foo = a: 1 ) do not inherit the .entries, .keys, or .values functions as properties, and I must access those functions by calling Object.entries(foo) as pointed out by tehhowch / SylvainF. Working code:



Object.defineProperty(Object.prototype, 'swapKeysValues', 
value: function()
let obj = ;
Object.entries(this).forEach(([key, value]) =>
obj[value] = key;
);
return obj;

);

// Example
let foo = a: 1, b: 2, c: 3
foo.swapKeysValues()

// Output
1: "a", 2: "b", 3: "c"



Thank you tehhowch / SylvainF!







node.js nwjs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 13:59







caffeinatedbits

















asked Mar 8 at 13:35









caffeinatedbitscaffeinatedbits

236




236







  • 1





    If you create a function with the keyword function, this will refer to the function itself. There is no entries method defined in your function.

    – Seblor
    Mar 8 at 13:37







  • 1





    Object.entries(someObj).

    – tehhowch
    Mar 8 at 13:39











  • I don't understand, considering I'm running the above 'foo' test code in the developer tools console. Same result in Chrome 72 browser.

    – caffeinatedbits
    Mar 8 at 13:46












  • 1





    If you create a function with the keyword function, this will refer to the function itself. There is no entries method defined in your function.

    – Seblor
    Mar 8 at 13:37







  • 1





    Object.entries(someObj).

    – tehhowch
    Mar 8 at 13:39











  • I don't understand, considering I'm running the above 'foo' test code in the developer tools console. Same result in Chrome 72 browser.

    – caffeinatedbits
    Mar 8 at 13:46







1




1





If you create a function with the keyword function, this will refer to the function itself. There is no entries method defined in your function.

– Seblor
Mar 8 at 13:37






If you create a function with the keyword function, this will refer to the function itself. There is no entries method defined in your function.

– Seblor
Mar 8 at 13:37





1




1





Object.entries(someObj).

– tehhowch
Mar 8 at 13:39





Object.entries(someObj).

– tehhowch
Mar 8 at 13:39













I don't understand, considering I'm running the above 'foo' test code in the developer tools console. Same result in Chrome 72 browser.

– caffeinatedbits
Mar 8 at 13:46





I don't understand, considering I'm running the above 'foo' test code in the developer tools console. Same result in Chrome 72 browser.

– caffeinatedbits
Mar 8 at 13:46












1 Answer
1






active

oldest

votes


















0














Like @tehhowch says in the comments, the syntax is Object.entries(foo)



You can see the MDn page: https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Object/entries






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55064333%2fobject-entries-is-not-a-function-in-nwjs-0-36-3-node-11-10-1%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Like @tehhowch says in the comments, the syntax is Object.entries(foo)



    You can see the MDn page: https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Object/entries






    share|improve this answer



























      0














      Like @tehhowch says in the comments, the syntax is Object.entries(foo)



      You can see the MDn page: https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Object/entries






      share|improve this answer

























        0












        0








        0







        Like @tehhowch says in the comments, the syntax is Object.entries(foo)



        You can see the MDn page: https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Object/entries






        share|improve this answer













        Like @tehhowch says in the comments, the syntax is Object.entries(foo)



        You can see the MDn page: https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Object/entries







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 8 at 13:41









        SylvainFSylvainF

        183113




        183113





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55064333%2fobject-entries-is-not-a-function-in-nwjs-0-36-3-node-11-10-1%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            1928 у кіно

            Захаров Федір Захарович

            Ель Греко