Skip to content

kevduc/jsconsole

Repository files navigation

jsconsole

⬛ Basic js console in js, jsception

🎯 Goal of this mini-project

✍ Practice JavaScript:

  • Classes (definition, constructor, methods, composition)
  • ES6 Modules (import, export)

👇 Examples

You can do fun things like accessing the jsconsole from within itself:

The possibilities are unlimited 🧙‍♂️

Try executing this code in the jsconsole:

const consoleElement = document.querySelector('#console'); let {x, y} = consoleElement.getBoundingClientRect(); const updateConsolePosition = (x, y) => { consoleElement.style.top = `${y}px`; consoleElement.style.left = `${x}px` }; updateConsolePosition(x, y); consoleElement.style.position = "absolute"; const movementSpeed = 10; let key = ''; jsconsole.input.addEventListener("keydown", (e) => key = e.key); jsconsole.input.addEventListener("keyup", (e) => key = ""); setInterval(() => { switch(key) { case "w": { y -= movementSpeed; break; } case "s": { y += movementSpeed; break; } case "a": { x -= movementSpeed; break; } case "d": { x += movementSpeed; break; } default: break; } updateConsolePosition(x, y); }, 17); jsconsole.clear(); "Use the WASD keys to control the jsconsole!"

🕹 Have fun!

About

⬛ Basic js console in js, jsception

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published