javascript - Knockout.js pulling element from observableArray returns undefined -


here code using in larger function:

this.categoriestosearch = ko.observablearray(["food"]);// initial selection console.log(this.categoriestosearch[0]); 

running returns undefined. knockout.js documentation says observablearrays supposed read way. there better way read observablearrays?

answering own question since came answer right after posting: observablearrays functions correct way pull item is:

this.categoriestosearch()[0] 

Comments