# Convert Object to Number

**URL:** <https://forum.kirupa.com/t/convert-object-to-number/143081>\
**Category:** Uncategorized\
**Created:** [April 3, 2005, 1:34am UTC](https://forum.kirupa.com/t/convert-object-to-number/143081 "2005-04-03T01:34:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jedhu0920](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jedhu0920/32/905_2.png) [@jedhu0920](https://forum.kirupa.com/u/jedhu0920)\
**Post date:** [April 3, 2005, 1:34am UTC](https://forum.kirupa.com/t/convert-object-to-number/143081/1 "2005-04-03T01:34:12Z")

</div>

I am using the following code to create an array of grid coordinates. After pulling my hair out for quite some time, I did a trace (typeof) and found out that the coordinates are going into the array as objects. Obviously, I need numbers. Does anyone know how to convert the array values to numbers instead of objects?

(as you can see, I wrapped my push command with the Number() operator, but it still turns out to be objects!)

```auto
gridCoords = new Array();
function createCoords() {
	gridx = 190;
	gridy = 190;
	for (var i = 0; i<=loopNumber; i++) {
		for (var j = 0; j<3; j++) {
			gridCoords.push([[Number(gridx*j)], [Number(gridy*i)]]);
		}
	}
}

```
