The Official Blog of Patcoola

Im just a dude watching over my parents,
and trying to make cartoons and video games from home.

Script: Count Dimensions [JS]

, By Patcoola

Script Title: countDimensions
Programming Language: Java Script
Date Completed: 2013/02/26

Purpose: Counts the number of dimensions in an array.

Advertisement

Donate Now!

Hey buddy, it takes a lot to make a blog. How about a donation?


Description: Gets the number of dimensions in an array, returns a number or undefined if the input is not an array.

Method:

countDimensions ( array_a );

Example Usage:

var array_a = new Array();
array_a.push( [“hello”, [“hello2″,”1”]],[“hi”, “1”, “3”] );

countDimensions ( array_a );

Returns 3

Example Usage:

var array_a = new Array();
array_a.push( [“hello”, [“hello2″,”1”]],[“hi”, “1”, “3”] );

countDimensions ( array_a[0] );

Returns 1

 

Advertisement

Donate Now!

Hi there, I spend a lot of time making this blog.

It would be great if you would consider donating.


 

Post Meta

Share Post

 

Comments: Write Comment

Be the first to write a comment.


Leave a Comment


All comments are reviewed before publishing. Comments must be related to the page topic, must not be spam, and must comply with the criminal code of Canada.