Javascript (js) is a programming language used to add interaction and function to your web pages. JS is one of the core languages that work together to make a website, also known as the “3 good friends”(HTML the builder - CSS the artist - JS the wizard). Each of these three friends serve their own purpose while working together for the same goal which is building the house also known as the webpage:
HTML: defines what is on the page.
THE BUILDER!!! - HyperText Markup Language (HTML) just like the nickname says , it takes care of the structure and framework of the house. In other words html is like the skeleton of the page, it provides the structure and content of a web page. It deals with things like headings, paragraphs and images and links.
CSS: defines how it looks.
THE ARTIST!!! - Cascading Style Sheets (CSS) takes care of decorating and designing the interior and exterior of the house. CSS takes care of the presentation and the styling of the content provided by the HTML. It is in charge of the appearance of the house or webpage in this case, it controls how elements look, including things like colours, fonts, and spacing.
JS: defines how it behaves and interacts with the user.
THE WIZARD!!! - Javascript (JS) takes care of the functions and utilities like electricity and plumbing. JS got its nickname due to its ability to add interactivty and dynamic behaviour to websites making the HTML come alive. Acting like a magical force behind the scenes of the website. It handles user interactions, manipulates the DOM (Document object model), fetches data and much more like creating animations and visual effects and handling the html content and css styles dynamically.
Conrtol flow statements control the order in which things happen. Imagine something like making logical decisions, take getting ready to go out for example, you look outside and you see it might rain so you then make the decision to take an umbrella.
Loops are a repetition of an action, they are essential for tasks involving iteration over data structures , performing actions multiple times, or handling repetitive operations efficiently. you use them when you need same action to be repeatedly executed. For example i have made a very simple loop. so here is my fruitloop, where it shows how many fruit i have eaten while trying to reach my daily goal of 5.
Arrays are like a list that can hold multiple values in one variable. They are quite useful because they let you store and organize multiple values in one place instead of using lots of separate variables. Since we are already familiar with fruits lets use them as an example
Objects store related information together in key value pairs. People use them a lot to organize information with names instead of just numbers (like arrays). The way it helps me remember is to think about an object like a car where each key is a property and the value is the details about such key. You can also use a person as an example and i find
Functions are a set of code that are designed to perform a specific task. They can help you write code once and use it many times, keep your code organized, and make websites that can change and respond to what users do. Functions can accept input values called parameters, defined within the parentheses during declaration. When the function is called, the actual values passed are called arguments.
The DOM or the Document Object Model is an interface for web douments. it lets us interact with the objects of an HTml document. with a tree-like hierarchy of objects which sounds a little complex but if i understand it right, its like a tree and the elements are branches growing out. We manipulate the Dom using Javascript, allowing us to change, remove and add things to out page.