Hey guys , i have a question about the extend function , check out my fiddle .
now i hav ethe following code :
- var a = {
- 'lala' : 'one',
- 'baba' : 'two',
- 'dada' : 'three',
- 'kaka' : 'four',
- }
-
- var b = {
- 'lala' : 'one',
- 'baba' : 'two',
- 'dada' : 'three',
- 'kaka' : 'four',
- }
-
- var _str = $.extend({} , b , a);
-
- console.log(_str);
now the doc's says that when u add an empty {} object literal as the 1st param , the merged objects are preserved . but i don't see a difference doing either ,
- var _str = $.extend({} , b , a);
or
- var _str = $.extend( b , a);
the result is
Object { lala: "one", baba: "two", dada: "three", kaka: "four" }
also what is the 4th param in $.extend for ?.
Thanks .