How does the extend() function work in jQuery?

前端 未结 6 1768
时光取名叫无心
时光取名叫无心 2020-12-12 11:04

I saw this in a plugin:

var options = $.extend(defaults, options); 

How does it work?

What does extend() do?

6条回答
  •  无人及你
    2020-12-12 11:42

    From jQuery Documentation

    Merge the contents of two or more objects together into the first object.

    In a plugin context: If the user does not set the optional parameters for the function, then a default value will be used instead.

提交回复
热议问题