Logo

Programming-Idioms

History of Idiom 52 > diff from v42 to v43

Edit summary for version 43 by Vaporox:
[JS] The underscores are there just to emphasize the variable names.

Version 42

2020-08-07, 19:29:05

Version 43

2020-08-07, 19:30:53

Idiom #52 Check if map contains value

Determine whether map m contains an entry with value v, for some key.

Idiom #52 Check if map contains value

Determine whether map m contains an entry with value v, for some key.

Variables
m,v
Variables
m,v
Extra Keywords
table dictionary hash
Extra Keywords
table dictionary hash
Code
[..._m.values()].includes(_v)
Code
[...m.values()].includes(v)
Comments bubble
Unlike the previous implementation, this works for Map objects rather than normal Objects.
Comments bubble
Unlike the previous implementation, this works for Map objects rather than normal Objects.