Codelab Editor
Free Online HTML Editor
Run
Learn JSON
<!DOCTYPE html> <html> <head> <style> body { padding: 10px; background: #fdfdfd; font-family: sans-serif; } pre { background-color: #eee; padding: 10px; border-radius: 6px; overflow-x: auto; display: none; } button { margin-right: 10px; padding: 8px 16px; border: none; background-color: #0088cc; color: white; border-radius: 6px; cursor: pointer; } button:hover { background-color: #006fa3; } h3 { margin-top: 20px; } </style> </head> <body> <h2>Accessing Array Values using Destructuring</h2> <p>Click the button to access array elements using <kbd>[a, b, c] = array</kbd> destructuring syntax.</p> <button onclick="accessLanguages()">Access Values</button> <h3 id="arrayTitle" style="display:none;">Language Array</h3> <pre id="arrayOutput"><code></code></pre> <h3 id="valueTitle" style="display:none;">Accessed Values</h3> <pre id="valueOutput"><code></code></pre> <script> function accessLanguages() { const languages = ["JavaScript", "Python", "Go"]; const [js, py, go] = languages; document.getElementById('arrayTitle').style.display = 'block'; document.getElementById('valueTitle').style.display = 'block'; document.getElementById('arrayOutput').style.display = 'block'; document.getElementById('valueOutput').style.display = 'block'; document.querySelector('#arrayOutput code').textContent = `const languages = ${JSON.stringify(languages)};`; document.querySelector('#valueOutput code').textContent = `first → ${js} second → ${py} third → ${go}`; } </script> </body> </html>
Editor Commands
Ctrl
F
Find
Ctrl
G
Find Next
Ctrl
⇧
G
Find Previous
Ctrl
⇧
F
Find & Replace
Ctrl
]
Indent Code Right
Ctrl
[
Indent Code Left
⇧
Tab
Auto Indent Code
Ctrl
/
Line Comment
Ctrl
Alt
/
Block Comment
TutsInsider Actions
Alt
S
Run Code
Ctrl
C
Copy Editor Code
Ctrl
A
Select All Editor Code
Ctrl
S
Save/Download
Ctrl
Alt
X
Rotate
Ctrl
Alt
T
Switch Theme
Ctrl
⇧
C
Open Console
Esc
Close Console