Why is JavaScript so powerful that you can't run from it?

Any programming language that cannot access, modify, program and react to the browser cannot compete with Javascript.

The ability to change content on the browser and react to the user activities is something we cannot overemphasize. Being able to manipulate the browser makes the language so hard to ignore. If you don't like it, you will still use Javascript (as long as you have something to do with the web). 

If you hate or dislike Javascript, it's time you start loving it. Javascript is like a wallet or handbag; if you refuse to carry it, you will end up taking a bit of what's in it (call card, credit cards, money etc.).

As mentioned, Javascript allows you to make confident decisions on the page. Like adding interactivities, modifying content based on users' actions, etc. In this post, I will share four (4) powerful features of Javascript. 

If you understand Javascript's actual strength, you don't need to struggle with it anymore. So without further ado, let us dive into it.


1. Access Content with Javascript

You can use Javascript to target and select any element on the page at any point in your project state. But, similarly to how you can use CSS to target any tag, attributes on the page, Javascript allows you to do much more. 

  • With Javascript, you can select all the text in an h1 tag.
  • You can choose elements with a specific class name.
  • Whenever the user inputs information in a form, you can grab the value by targeting that specific input field (no matter the number of other input fields available on the current page).

In summary, whatever exists on your web page, you can grab it with Javascript. 


2. Modify Content with Javascript

The essence of grabbing content from the webpage will be to do something with it. Trust me; Javascript does this a lot. 

With Javascript, you can add new tags, attributes or remove them even if you like. 

  • For instance, you can add a paragraph just before an h1 tag. 
  • In some cases, you want to add an extra class name to a tag whenever the user clicks or hover; you can achieve this with the Javascript toggle method. 
  • In another instance, you can use Javascript to increase the size of an image whenever the user clicks the smaller version.

Think it this way; when you want to update a portion of a page whenever something happens, seek Javascript.


3. Write Executable Logic with Javascript

This is where most people find it challenging. Javascript allows you to specify some sets of steps in which the browser will execute accordingly (like a recipe). 

  • For instance, if you create a user gallery page, you would want to know which user is clicked to show the appropriate information that belongs to the user. 
  • A financial calculator (specifically an interest rate calculator). You will need to get the user input to carry out the necessary calculation and print out the value to the user. 
  • Another aspect is animation. To carry out animation on the webpage, you will need to determine the size of the window and move the image from the bottom to the top (checking for the viewport sizes).

To summarise this section, Javascript allows you to declare steps, and the browser will execute them for you.


4. Javascript React to Events

This is where superiority comes in; With Javascript events, you can specify which script (logic) should run when an event occurs. For instance, you can do something: 

  • When a webpage finishes loading 
  • When a button is pressed, clicked or tapped.
  • Within a time range or when a time has passed.
  • When a cursor hovers over an element.



Javascript allows you to add more functionality to your webpage; if this is what it does, why dislike it? Instead of opposing it, embrace it instead. 

With the powerful programming language, you can access content on the page, modify the content you selected, program steps for the browser to execute and react to users actions on your webpage.

If this was helpful, kindly share and leave a comment. 

Post Comments(0)

Leave a reply