0

Hi there I'm having small problem, I'm filtering my json on objects but actually as You will guess its does not work could you tell me what I am doing wrong ?

global.selection.Data.Options.filter(function (optionItem) {
return optionItem.hidden === false  })

Json :

options : [0 : {name: "some name", hidden:false}]
Okami Okami
  • 45
  • 1
  • 6

2 Answers2

1

You are doing a type-specific comparison with === against string 'false', but you actually have a primitive boolean false in your array.

Match against a primitive boolean instead (hidden === false).

jlaitio
  • 1,878
  • 12
  • 13
0

Try doing either optionItem.hidden == false or optionItem.hidden === false. As 'false' is a non-empty string hence it is truthy in javascript.

KalyanLahkar
  • 835
  • 8
  • 21