Index is undefined

index.search(‘smartphone’, {
filters: ‘brand:Motorola’
}).then(({ hits }) => {
console.log(hits);
});

I get an error says that index is undefined.

Hi there!
It looks like index is not defined in your javascript scope.

Could you confirm that you’re indeed initializing it properly in the same scope as this code ?
Here’s a link to a doc to initialize your index client: https://www.algolia.com/doc/guides/getting-started/quick-start/tutorials/quick-start-with-the-api-client/javascript/?language=javascript#initialize-the-client

Hope this helps