TypeScript Array Object.values() Method Last Updated : 12 Jul, 2024 Comments Improve Suggest changes Like Article Like Report Object.values() is a functionality in TypeScript that returns an array extracting the values of an object. The order of elements is the same as they are in the object. It returns an array of an object's enumerable property values. Syntax:Object.values(object);Parameters:object: Here you have to pass the object whose values you want to extract.Return Value:An array that contains the property values of the given object which are enumerable and have string keys. NOTE: Since Object.values() is not directly available in TypeScript, we will implement it using the interface class. Example 1: Basic ImplementationThe below code example is the bais implementation of object.values() method in TypeScript. TypeScript interface Geek { name: string; workForce: number; } const geek: Geek = { name: "GeeksforGeeks", workForce: 200 }; const valArray: (number | string)[] = Object.values(geek) console.log(valArray); Output:["GeeksforGeeks", 200]Example 2: Implementation with Different Data TypesIn this example we defines an interface Car and two car objects car1 and car2. It then uses Object.values() to extract and log the values of these objects as arrays, showing their properties. JavaScript interface Car { carName: string; carNumber: string; model: number, sportsCar: boolean } const car1: Car = { carName: "Alto", carNumber: "AB05XXXX", model: 2023, sportsCar: false }; const car2: Car = { carName: "F1", carNumber: "AB05X0X0", model: 2024, sportsCar: true }; const carArr1 = Object.values(car1); const carArr2 = Object.values(car2); console.log(carArr1); console.log(carArr2); Output:["Alto", "AB05XXXX", 2023, false] ["F1", "AB05X0X0", 2024, true] Comment More infoAdvertise with us Next Article TypeScript Array Object.values() Method pankajbind Follow Improve Article Tags : JavaScript Web Technologies TypeScript Similar Reads TypeScript Array Object.entries() Method The Object.entries() method in TypeScript is used for creating an array of key-value pairs from an object's keys and values. This method simplifies the process of iterating over an object's properties and enables easier data manipulation.SyntaxObject.entries(obj);Parameterobj: It takes the object as 3 min read JavaScript Object values() Method JavaScript object.values() method is used to return an array whose elements are the enumerable property values found on the object. The ordering of the properties is the same as that given by the object manually if a loop is applied to the properties. Object.values() takes the object as an argument 3 min read TypeScript Array entries() Method The Array.prototype.entries() method in TypeScript returns a new array iterator object that contains the key/value pairs for each index in the array. This method is useful when you need to iterate over the key/value pairs in the array.Note: In TypeScript, the entries() method is not available direct 2 min read TypeScript Object The Array Type In TypeScript, the Array Type is used to specify and enforce the type of elements that can be stored in an array, enhancing type safety during development. This adaptability ensures reusability across diverse data types, as exemplified by the Array type (e.g., number[] or string[]). Syntaxlet myArra 2 min read JavaScript TypedArray.prototype.values() Method TypedArray's values() method returns a new iterator object for the array, this iterator will allow you to traverse through typed arrays and generate the value of each element at every position and like values() method for normal JavaScript arrays, it serves a similar role. SyntaxtypedArray.values()P 1 min read JavaScript Array values() Method JavaScript array.values() is an inbuilt method in JavaScript that is used to return a new array Iterator object that contains the values for each index in the array i.e., it prints all the elements of the array. Returns an iterator for accessing array values.Does not modify the original array.Works 5 min read TypeScript Arrays An array is a user-defined data type. An array is a homogeneous collection of similar types of elements that have a contiguous memory location and which can store multiple values of different data types.An array is a type of data structure that stores the elements of a similar data type and consider 5 min read JavaScript Array valueOf() Method The JavaScript Array valueOf() method in JavaScript is used to return the array. It is a default method of the Array Object. This method returns all the items in the same array. It will not change the original content of the array. It does not contain any parameter values. Syntax: array.valueOf()Par 2 min read JavaScript TypedArray.of() Method The TypedArray.of() method is used to create a new array from a variable number of arguments that are passed to it. Syntax: TypedArray.of( el0, el1, el2, ...elN ) Parameters: This method accepts a variable number of elements, which are used to create the Int16Array array. TypedArray can contain any 2 min read Like