Jackie Chan
Jackie Chan

Reputation: 2662

Strange result when comparing properties

Could you please explain me the following. Trying to compare object attributes: newName of the v and rowData objects. Got back values report3 and report2, however on comparison (rowData.newName === v.newName) these values are equal??!! Please refer to the console message below

Values are strings, belong to different objects.

console.log('== NEW NAME OF THE VALE OF TABLE ==');
console.log(v.nameNew); // which is report3
console.log('== NEW NAME OF THE DATA OF THE ROW ==');
console.log(rowData.nameNew); // which is report2
console.log('== IDIOT PROOF TEST ');
console.log(rowData.newName === v.newName);

CONSOLE LOG:

== NEW NAME OF THE VALE OF TABLE ==
Report3
== NEW NAME OF THE DATA OF THE ROW ==
Report2
== IDIOT PROOF TEST
true

Upvotes: 0

Views: 66

Answers (1)

Hugo Migneron
Hugo Migneron

Reputation: 4907

Not sure if you mistyped it but you log

console.log(v.nameNew);

You then compare

v.newName

If you made a mistake and are actually comparing the right variables, can you post more code (how you are declaring them and assigning them)

Upvotes: 5

Related Questions