replace
Replace all the elements of a DefineList.
list.replace(collection)
Replaces every item in the list with collection.
import {DefineList} from "can";
const names = new DefineList(["alice","adam","eve"]);
names.replace(["Justin","Xena"]);
console.log(names.get()); //-> ["Justin","Xena"]
Parameters
- collection
{Array|can-define/list/list}:The collection of items that will be in
list.
Use
replace is essentially a shortcut for splice.
Events
replace causes remove, add, and length events.