What are the 5 essential basics that you will need to know in javaScript?


To create and display a website in your browser you need HTML, to embellish it with colors and shapes you used CSS They are very static web pages. That is, the content does not change.

Remember that HTML is a description language and CSS is a cascading style language. They cannot be dynamic.

How can you make a website dynamic?


Fortunately, some developers have thought about it before you and me by building some programming languages ​​capable of creating dynamic web pages Some run on the server-side only, for example, JAVA, PHP, RUBY, PYTHON, … and only one is also run on the client-side HTML, CSS, and JavaScript run on the client-side (in the browser). Not bad Other researchers with a lot of beards and hair took to JavaScript, a programming language that ran on the client-side only. They have developed NodeJs a powerful tool that allows running javascript on the server side The basics to know to evolve faster with JavaScript revolve around:

  • ➡️ How to use JavaScript console.log ()?
  • ➡️ How to use the Javascript dom API?
  • ➡️ How to display an alert message?
  • ➡️ How do I request confirmation from a user?
  • ➡️ How to request information from an Internet user via windows prompt?
  1. Using console.log ()

How to use javascript console.log ()?

All web browsers, the Node.JS platform is any well-configured javaScript environment that supports the writing of messages in the console with the logging function.

It’s simple, you start with:

  • Open your browser.
  • CTRL + D or You right-click while choosing the Examine page elements menu.
  • You choose the console tab.

Display a variable

console.log ()can be used to display variables of any type; not just strings Just pass the variable you want to display in the console,

If you want to save and display two or more values, just separate them with commas Spaces will be automatically added between each argument during concatenation:



You can also use console.log () in combination with reserved formatting systems:

Logging Objects

Below you have the result of saving an object. This is often useful for logging JSON responses to API calls.

  • log({
  • ‘Email’: ”,
  • ‘Groups’: {},
  • ‘Id’: 1,
  • ‘IsHiddenInUI’: false,
  • ‘IsSiteAdmin’: false,
  • ‘LoginName’: ‘bcdibwe’,
  • ‘Title’: ‘Administrateur’
  • });

To display HTML elements:


The result visible in the console: HTMLBodyElement { … }

  1. Using the DOM API

How to use the Javascript DOM API?

DOM stands for Document Object Model. It is an object-oriented representation of structured documents such as XML and HTML.

Setting the property textContentof an item is a way to output text on a web page For example, consider the following HTML tag:

  • <p id=”paragraph”></p>

To change its property textContent, we can run the following JavaScript:


It is very important to know


Manipulating elements in the DOM using JavaScript code must be performed after the relevant element is created in the document. This can be achieved by placing JavaScript tags <script>after all of your other content <body>. Alternatively, You can also use an event listener to listen for example An download window event, adding your code to this event listener will delay your code execution until all of your page content has been loaded A third way to make sure that all of your DOM has been loaded is to wrap the DOM manipulation code with a 0ms timeout function This way that JavaScript code gets re-queued at the end of the execution queue, giving the browser a chance to finish doing non-JavaScript things that were waiting to be completed before. to participate in this new piece of JavaScript.


  1. Using Windows.alert ()

How do I display an alert message?

The alert method displays a box, a visual popup on the screen. The alert method parameter is displayed to the user in plain text:


However, the specification actually allows other event-triggered code to continue executing even though a modal dialog is still displayed In such implementations, it is possible that another code is executing while the modal dialog is displayed The use of alerts is generally discouraged in favor of other methods that do not prevent users from interacting with the page in order to create a better user experience Nevertheless, it can be useful for debugging


I have just given you the 5 essential JavaScript basics that will get you started. Yes, you will evolve faster There is still a long way to go, especially since this programming language is undergoing exponential development. Tros even Every day there are new code structures for frameworks and libraries. But, without exception they are all based on pure JavaScript Patent of that, I explained this:

  • ➡️ How to use JavaScript console.log ()?
  • ➡️ How to use the Javascript dom API?
  • ➡️ How to display an alert message?
  • ➡️ How do I request confirmation from a user?
  • ➡️ How to request information from an Internet user via windows prompt?





Please enter your comment!
Please enter your name here