JS Question

Hello I’m currently working in a simple “Vanilla JavaScript – To Do App” you can see the Work In Progress: todo.mycode.website

In the early stages I found a chrome behavior that raise a question about Plain-Vanilla JavaScript, lest start with the question first and then, the explanation(documentation) of the question:

“Why the results of console.log() in Chrome are modify BEFORE we call the function that will modify them.???”

Now the Explanation:
when I use Google Chrome “to console.log()” the “Console” display a modify Object before we get to the Function to modify the Object.

Scenario:

Im creating a basic Todo-App stored in a Object, with the following Code.

As you can see the property “td_obj.list” originally has two elements, then we execute 3 commands (functions):

  1. First we print it (on the console)
  2. Then we add a new task & print it.
  3. Finally we change an element & print it.

When runnign this code “Google Chrome Console” should print:

But Instead “Google Chrome Console” prints:

For more details see “print screen” below

 

But when I run the same code on JsBin the output if as expected (No modification before function is call), to see this code on JsBin –  Link

I also have the files that I use on Google Chrome in GitHub: Link

Finally I have this code in a live website:   test.mycode.website

  1. Open Chrome
  2. Open Dev-Tools
  3. Select Console

Why the results of console.log() in Chrome are modify BEFORE we call the function that will modify them.???
is this a BUG in Chrome???
why is doing this???
how can I avoid it???

.



Copyright 2017. All rights reserved.

Posted February 21, 2017 by Edmundo in category "Miscellaneous