Object length in JavaScript Object length in TypeScript

Object length in JavaScript Object length in TypeScript. How to get Object length in JavaScript or in TypeScript, Here is code example for get length or count of Object in TypeScript and JavaScript.

JavaScript have length property for array type variable but for type Object length property not exists.

For get length and size of Object in TypeScript or JavaScript language below are detailed sample code.

JavaScript
JavaScript

Object length in JavaScript sample code

(Object).keys(myObject).length

Object length in TypeScript sample code

(<any>Object).keys(myObject).length