JavaScript-DOM




Home Identity learning Plan About Te-houtae-wa Classes vs ids EQ Vs IQ Neuroplasticity Te-whare-tapa-wha problem-solving







JavaScript,HTML and CSS

Hey there! Imagine you're a web developer and your code is like building a digital playground. Now, let's talk about three essential buddies in this playground: HTML, CSS, and JavaScript.



JavaScript, the Puppet Master

Think of JavaScript like the puppet master behind the scenes pulling the strings. HTML provides the structure (like the slides and swings), CSS styles things up (adding colours and designs) and then JavaScript brings it all to life. It's the one making things move, responding to your clicks, and adding a touch of magic to your digital playground


JavaScript



Control Flow and Loops, AKA Choreography

Control flow is like choreographing a dance routine. Loops are your dance steps repeating until a certain condition is met. Let us say you're baking cookies: you mix ingredients, put dough in the oven and repeat until you have a tray full of deliciousness.


ex.js

In this code, the loop repeats the process of baking a cookie 12 times, filling your tray with freshly baked goodness.



DOM, Your Playground Blueprint


The DOM (Document Object Model) is like the blueprint of your playground. It's a structured representation of your HTML, and JavaScript uses it to interact with your webpage. Imagine you have a checklist for your playground equipment – that's the DOM.


dom.js

Here, JavaScript finds the button in the DOM by its ID and changes its background color to green.



Arrays vs. Objects: Data's Wardrobe


Arrays and objects work as the having to walk into your wardrobe coding store. Arrays are ordered lists, much like having an ordered sock collection that has a certain place for each pair of socks. Objects, much like accessories, bring flair - each property containing its own name. Such coding elements as a proper wardrobe does add to the efficiency and orderliness of your code, providing for orderly storage and retrieval of information.

Arrays

Functions: Your Code's Helpers


Functions are the superheroes of your code. Imagine them as mini-scripts that can be called to perform specific tasks. They save you from repeating the same code over and over. For example, if you have a recipe for making pancakes, you could encapsulate it in a function called ⁠ makePancakes() ⁠.

Functions

So, in simple terms, HTML, CSS, and JavaScript work together to create cool digital experiences, and now you know a bit more about the friends behind the scenes.




& copy; 2024 Berhane. All rights reserved