JSFiddle - React, Tailwind, and code Playground

HTML

<div id="info"/>

JavaScript

function generateMaterials() {
    var mats = [];
    mats.push( new THREE.MeshBasicMaterial( { color: 0x00FF00 } ));
    mats.push( new THREE.MeshLambertMaterial( {   color: 0xFF0000} )); 
    return mats;
}

var test = generateMaterials();

var result = "array length:" +  test.length;
result += "<br>Mat 0 " + test[0];
result += "<br>Mat 1 " + test[1];
if (test[0] instanceof THREE.MeshBasicMaterial) {
    result += "<br> mat 0 type ok";
}

if (test[1] instanceof THREE.MeshLambertMaterial) {
    result += "<br> mat 1 type ok";
}


var output = document.getElementById("info");
output.innerHTML = result;