The HTML file:

<body>
<script type="text/javascript" src="code.js"></script>
</body>

code.js

'use strict'

function LogElement(value, key, map) {
    console.log('map[',key,'] = ',value);
}

function NewPosition() {
    return[ Math.round(Math.random()),
            Math.round(Math.random()),
	    Math.round(Math.random())]
}

function GetElement(map, position) {
    if (! map.has(position.toString())) {
        var newColor = [Math.random(), Math.random(), Math.random()];
	map.set(position.toString(), newColor);
    }
    return map.get(position.toString())
}


var myMap = new Map([  
                       [[0,0,0].toString(), [1.0,0.0,0.0]], 
		       [[0,0,1].toString(), [0.0,1.0,0.0]]
		    ]);
console.log("my map has ", myMap.size , " elements");

var k = [0,0,0].toString();
console.log("Checking for key ", k, " and  it is ", myMap.has(k));
console.log('direct access of ', k, ' returns ' , myMap.get(k));

console.log("Adding an element");
myMap.set([0,0,2],[0.0,0.0,1.0]);
console.log("my map has ", myMap.size , " elements");

myMap.forEach(LogElement);


for(var i=0;i<5;i++) {
    var position = NewPosition();
    var color = GetElement(myMap, position);
    LogElement(myMap.get(position.toString()),position, myMap);
}