filter
is a method on arrays. Since the code you posted contains an object, you’re seeing this error. You may want to apply filter after getting all the values from the object using Object.values
, like this:
var users = { "1": { "user_id": 1, "test": "", "user_name": "potato0", "isok": "true" }, "2": { "user_id": 2, "test": "", "user_name": "potato1", "isok": " true" }, "3": { "user_id": 3, "test": "", "user_name": "potato2", "isok": " true" }, "4": { "user_id": 4, "test": "", "user_name": "potato3", "isok": "locationd" } }; console.log(Object.values(users).filter(user => user.user_id === 1));
Related Posts:
- “Uncaught SyntaxError: Cannot use import statement outside a module” when importing ECMAScript 6
- map function for objects (instead of arrays)
- What’s the difference between using “let” and “var”?
- How to fix “Cannot read property ‘addEventListener’ of null” error [duplicate]
- How to import jquery using ES6 syntax?
- Node.js – SyntaxError: Unexpected token import
- Node.js – SyntaxError: Unexpected token import
- forEach is not a function error with JavaScript array
- Getting Unexpected Token Export
- React with ES7: Uncaught TypeError: Cannot read property ‘state’ of undefined
- Using Node.js require vs. ES6 import/export
- Cannot find module ‘@angular-devkit/core’
- How can I mock an ES6 module import using Jest?
- How can I quickly retrieve a value from a MapIterator returned from Object.keys function?
- Give a value to an ng-model=”searchText” input based on list item clicked in Angular JS
- How to scroll to an element?
- ES6: Create Strings using Template Literals – Freecodecamp
- Cannot read property ‘bind’ of undefined. React.js
- How to add multiple classes to a ReactJS Component?
- How can I group data with an Angular filter?
- SyntaxError: ‘import’ and ‘export’ may appear only with ‘sourceType: module’ – Gulp
- This.props.dispatch not a function – React-Redux
- Does ECMAScript 6 have a convention for abstract classes?
- Expected ‘this’ to be used by class method
- where is create-react-app webpack config and files?
- Getting “Cannot call a class as a function” in my React Project
- Error: Couldn’t find preset “es2015” relative to directory “/Users/username”
- Is there a way to create interfaces in ES6 / Node 4?
- How to handle Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause()
- How do I make the first letter of a string uppercase in JavaScript?
- How to format a JavaScript date
- “SyntaxError: Unexpected token < in JSON at position 0"
- How can a Discord bot create a hyperlink in a Discord message in an embed or in general? [closed]
- Disabling and enabling a html input button
- How do I test for an empty JavaScript object?
- TypeScript React.FC
confusion - Check if checkbox is checked with jQuery
- TypeError: Cannot read property ‘then’ of undefined
- Infinite Scrolling in Asp.Net MVC with jQuery / AJAX Issues
- What are the difference between $(document).bind(‘ready’, function) and $(document).ready(function() {})
- Getting “TypeError: failed to fetch” when the request hasn’t actually failed
- How can I print using JQuery
- Short circuit Array.forEach like calling break
- TypeError: Router.use() requires middleware function but got a Object
- How to send an email from JavaScript
- MissingSchemaError: Schema hasn’t been registered for model “User”
- classical inheritance vs prototypal inheritance in javascript
- Uncaught TypeError: Cannot read property ‘value’ of null
- How to subtract date/time in JavaScript?
- var.replace is not a function
- Uncaught TypeError: Cannot read property ‘call’ of undefined at __webpack_require__
- Async/await in componentDidMount to load in correct order
- Dynamically load JS inside JS
- Tainted canvases may not be exported
- How to open a URL in a new Tab using JavaScript or jQuery?
- How to sort an object array by date property?
- React router not showing browser history
- How to define DO NOTHING in JavaScript
- How to get the difference between two arrays in JavaScript?
- What happened to Lodash _.pluck?
- Simplest/cleanest way to implement a singleton in JavaScript
- Extract hostname name from string
- How to connect signalR from angularJs
- JavaScript button onclick not working
- What counts as CPU Intensive tasks (eg. sorting, searching etc?)
- HTML make text clickable without making it a hyperlink
- Uncaught ReferenceError: React is not defined
- How to get the browser viewport dimensions?
- Getting HTML form values
- Javascript callback function throws error “Callback is not a function” in firefox
- How can I stop the browser back button using JavaScript?
- JavaScript isset() equivalent
- $http.get(…).success is not a function
- WordPress 5.5 – ReferenceError: commonL10n is not defined error
- How to load translation in JavaScript?
- wp_register_script multiple identifiers?
- Setting HTML properties in a Gutenberg plugin using WordPress settings
- customize_preview_init: listening for any changes from Customizer preview area
- Enqueue scripts all over but not in single.php
- Add toggle button for mobile sub-menus
- why code javascript ,not repeat the loop main wordpress
- Adding code to head to all pages manually
- Javascript on Registration Page
- How to modify the paths of js from twentytwelve theme?
- Unable to remove meta box from custom post for all non admin users
- how can i send this to wp_head – escape problem
- Append html to div
- Change each text after 4 second and each image after 2 second
- Hook a script as the very last one before the closing body tag
- Problem extending a core block
- google pie chart in wordpress
- How to locate the js code and php code for certain function?
- Insert HTML markup to page content from the Media Frame modal
- Call javascript function when add_attachment hook fires
- create to search column
- Variations Javascript not working when product display on Quick view via ajax
- Convert javascript running xml files to wordpress platform
- How do I find stylesheet & javascript handles? [duplicate]
- Mobile menu will only toggle on
- Broken links help with site