#!/usr/bin/env kjscmd

var empty = [];
var map1 = [];

var array = ["Test A", "Test B", "Test C", "Test D"];
var map2 = {"Test 1":"Test Map A", "Test 2":"Test Map B","Test 3":"Test Map C","Test 4":"Test Map D"};

map1["Test 1"] = "Test Map A";
map1["Test 2"] = "Test Map B";
map2.length = 1;
empty.length = 3;

list = ["Test A"];
list[3] = "Test B";
list[5] = "Test C";
list[7] = "Test D";

println( "Sparse value 2:" + list[2] );
try {
	println( "Array: " + array.length );
	println( "Array max value: " + array[array.length - 1] );
} catch(x) { println( "Error: " + x); }

try {
	println( "Map1: " + map1.length );
	println( "Map1 max value: " + map1[map1.length - 1] );
} catch(x) { println( "Error: " + x); }

try {
	println( "Map2: " + map2.length );
	println( "Map2 max value: " + map2[map2.length - 1] );
} catch(x) { println( "Error: " + x); }

try {
	println( "List: " + list.length );
	println( "List max value: " + list[list.length - 1] );
} catch(x) { println( "Error: " + x); }

try {
	println( "Empty: " + empty.length );
	println( "Empty max value: " + empty[empty.length - 1] );
} catch(x) { println( "Error: " + x); }

System.KJSConfig.writeListEntry("Test Array", array );
System.KJSConfig.writeListEntry("Test Map1", map1 );
System.KJSConfig.writeListEntry("Test Map2", map2 );
System.KJSConfig.writeListEntry("Test List", list );
System.KJSConfig.writeListEntry("Test Empty", empty );