0

I am using VueJS and jQuery with following dependencies. Can someone explain why the result is true in one place and false in other?

enter image description here

"dependencies": {
    "bootstrap": "^4.3.1",
    "bootstrap-vue": "^2.1.0",
    "core-js": "^3.3.2",
    "jquery": "^3.4.1",
    "vue": "^2.6.10"
 }
EldhoM
  • 13
  • 3
  • 1
    because `$` in the console isn't necessarily jquery ... with jQuery, that statement is NEVER true ... simply because `({} === {})` can never be true – Bravo Nov 15 '19 at 05:54
  • 2
    by the way, `jquery` AND `vue`? You're probably doing it wrong – Bravo Nov 15 '19 at 05:56

2 Answers2

0

You can not compare if two jQuery objects are the same. But you can compare DOM objects.

To know more about the comparison of jQuery object you can have a look at this Stackoverflow Answers

This link also has an explanation

PaulShovan
  • 2,140
  • 1
  • 13
  • 22
0

The dollar '$' in the console isn't jQuery. It's unable to access jQuery because it's not in the global scope. Besides, when comparing two jQuery objects, they always return false because they are not equal. In the console, because two objects aren't jQuery objects, they are both null instead, thus they are equal.