Computer >> Computer tutorials >  >> Programming >> Javascript

What is the role of brackets ([ ]) in JavaScript Regular Expressions?


As per my knowledge ([]) is used in Knockout.js this is used to define the observableArray. Please find the example and link below.

// This observable array initially contains three objects
var anotherObservableArray = ko.observableArray([
    { name: "Bungle", type: "Bear" },
    { name: "George", type: "Hippo" },
    { name: "Zippy", type: "Unknown" }
]);

https://knockoutjs.com/documentation/observableArrays.html