jquery random color change every second code example

Example 1: how to make a color change every second

local part = --what ever you want it to be
table = {
  Brickcolor.new("Bright Red"),
  Brickcolor.new("Forest Green"),
  Brickcolor.new("Lime Green")
end
while true do
	part.Brickcolor = math.random(table)
end

Example 2: javascript change background color setinterval

var i = 0;
function change() {
  var doc = document.getElementById("background");
  var color = ["black", "blue", "brown", "green"];
  doc.style.backgroundColor = color[i];
  i = (i + 1) % color.length;
}
setInterval(change, 1000);