JSFiddle - React, Tailwind, and code Playground

by Liu David

JavaScript

var arrayTest = [11,3,2,4,9];
    alert(arrayTest.sort(function(a,b){
      return a>b;
    }));

  
  var testObj = {
    2010:[101,102,103],
    2011:[111,112,113]
  };

  testObj[2012] = [121,122,123];
  testObj.string_key = "string key";
  testObj["string_key"] = "new string key";

  var arrVal1 = testObj[2010];
  arrVal1.push(5);

  var tmpKey1 = 2013;
  testObj[tmpKey1] = [131,132,133];

  for(var key in testObj)
  {
    alert("key " + key + " has value " + testObj[key]);
  }