WLJS LogoWLJS Notebook

KeyExistsQ

KeyExistsQ[assoc, key] returns True if the specified key exists in the association assoc, and False otherwise.

KeyExistsQ[key] represents an operator form of KeyExistsQ that can be applied to an expression.

Examples

Check if key exists:

KeyExistsQ[<|"a" -> 1, "b" -> 2|>, "a"]
(* True *)

Non-existent key:

KeyExistsQ[<|"a" -> 1, "b" -> 2|>, "c"]
(* False *)

Please visit the official Wolfram Language Reference for more details.

On this page