After using Jquery, how can you distinguish between using the method of the same name between JavaScript and jQuery?

for example, we have the map () method
in Javascript to apply a set of functions to each member of an array
in jQuery to convert several DOM nodes into other objects

how can conflicts be avoided?

Sep.08,2021

as long as you look at the object in which you are using the method, in the js native object is the js method, and in the jQuery object is the jQeury method.
there are many methods of the same name, except between JavaScript and jQuery, between Javascript and Php, there are also methods of the same name, all of which need some memory and understanding.
as long as you take the comparison seriously, you will understand the differences.


jq needs to select the node with the selector of jq before you can execute map.


JQ methods are all on top of the JQ object and do not conflict with native methods.
also, if possible, do not use JQ methods, such as $.map , because it is inconsistent with the interface of standard API

.
Menu