1. Home
  2. /
  3. Jsfiddle
  4. /
  5. Background Color Cycle

Background Color Cycle - Jsfiddle Typing CST Test

Loading…

Background Color Cycle — Jsfiddle Code

A JSFiddle snippet cycling background colors every second.

<!DOCTYPE html>
<html>
<head>
	<title>Color Cycle</title>
</head>
<body>
	<script>
		const colors = ["red", "green", "blue"]
		let i = 0
		setInterval(() => {
		document.body.style.backgroundColor = colors[i]
		i = (i+1)%colors.length
		}, 1000)
	</script>
</body>
</html>

Jsfiddle Language Guide

JSFiddle is an online IDE and code-sharing platform for web developers, allowing users to write, test, and share HTML, CSS, and JavaScript code snippets instantly in the browser.

Primary Use Cases

  • ▸Testing HTML, CSS, and JS code snippets
  • ▸Rapid front-end prototyping
  • ▸Sharing code examples and bug demonstrations
  • ▸Learning and teaching web development
  • ▸Experimenting with libraries or frameworks

Notable Features

  • ▸In-browser code editor with syntax highlighting
  • ▸Live preview of front-end code
  • ▸Supports multiple panels: HTML, CSS, JavaScript
  • ▸Ability to include external libraries and frameworks
  • ▸Shareable fiddles via unique URLs

Origin & Creator

JSFiddle was created by Piotr Zalewa in 2009 to provide a simple way for web developers to experiment and share code snippets quickly.

Industrial Note

Primarily used for front-end experimentation, quick prototyping, testing libraries, and sharing examples. Rarely used for full-scale applications or backend development.

More Jsfiddle Typing Exercises

Hello World in JSFiddleJSFiddle Button Click AlertJSFiddle Input and DisplayJSFiddle Change Color on ClickJSFiddle Simple CounterJSFiddle Hide and Show TextJSFiddle Clock ExampleJSFiddle Moving Box

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher