--- title: "Messages / hasObject" parent: "@messageformat/runtime" grand_parent: API Reference nav_exclude: true --- # Messages.hasObject() method Check if `key` is a message object for the locale **Signature:** ```typescript hasObject(key: string | string[], locale?: string, fallback?: boolean): boolean; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | key | string \| string\[\] | The key or keypath being sought | | locale | string | _(Optional)_ If empty or undefined, defaults to this.locale | | fallback | boolean | _(Optional)_ If true, also checks fallback locales | **Returns:** boolean ## Remarks `key` may be a `string` for functions at the root level, or `string[]` for accessing hierarchical objects. If an exact match is not found and `fallback` is true, the fallback locales are checked for the first match.