Is javascript really needed in building websites?

Yes i know html and css and am learning javascript but what i want to know is if javascript is important in creating a website? if no why? if yes why? and what will happen if is website built without javascript?

Hi Emeka.

JavaScript is pretty much indispensable in building a website in the current age of web technology. Especially if you aim to create web apps that service customers as end users, where part of your success relies on their having a great experience using the app.

Why?

In one word, JavaScript allows a developer harness the immense computational power of a clients computer, provided through their browser.

Essentially, the power of JavaScript lies in the amount of functionality that it allows a developer defer onto the users browser (client) as opposed to the server which requires an http round trip for the simplest of operations. Using JavaScript in an app allows for much greater user experience in that the user can achieve a lot without having to reload the whole page on every action.

Let’s make a simple illustration from Facebook. JavaScript is the only thing that makes it possible for you to scroll down your feed and like as well as comment on as many posts as possible without having the whole page reload on every small action. Also, when you click read more…, you notice the page doesn’t reload on? That’s JavaScript as well. It goes without saying how much more stressful it would be to use any social network without JavaScript backed functionality. Read up on Ajax (asynchronous JavaScript and…) to find out more about how this is done.

Some other things that using JavaScript allows for are:

  1. Client side validation: if you’d like to let users of your form know of any errors with the data they’re about to submit to your app before they click the submit button

  2. Client side computation: JavaScript is the only main stream way to achieve any logical operation on the user’s browser. Imagine you were making a simple calculator as a web app. Without JavaScript in your app, you’d have to send something as simple as 1+2 all the way to your server that could be at the other end of the world. However, if you use JavaScript, your calculator becomes as useful as a desktop app, because once the page is loaded once, your calculator will work even when they don’t have an internet connection.

HTML: Structure
CSS: Styling
JavaScript: Action, computation

Good luck discovering the awesomeness of using JavaScript in your app.

13 Likes

Good question.

Literally all that is needed to make a website is HTML.

HTML forms the structure of the site. To use the analogy of a house, HTML is literally the concrete walls. Yes, the house stands, but nobody really wants to move into a house with bare concrete walls, floors and ceilings. The house is still considered uncompleted (incomplete?).

So you paint the walls of the house, put curtains, tiles, carpets and whatnot to make the space look nice. CSS, like paint, curtains, tiles and carpets are literally not essential to the house, yet they play a important part. They beautify it. Non-essential, yet practically a requirement.

JS is another “non-essential yet practically a requirement”. Your house has windows, but you’d like to open them when it’s hot and close them when it’s raining. You want your living room lights on when it’s dark outside and off when there’s abundant sunlight. This is behavior - the same role Javascript plays in building a website. Javascript allows you to change things dynamically on the person’s computer when certain conditions are met. For example, play this audio clip only if the person presses this button labelled play. Or keep this menu hidden until the user presses this other button. Animate this progress bar when progress is made.

To recap: All that is needed to build a website is HTML, but more often than not you’ll end up using CSS and Javascript to make your digital home much more livable.

Happy coding :smile:

10 Likes

Just start, learnt it, use it. There are really no other alternatives for client side scripting.

1 Like

I will say yes. To add interactivity and responsiveness to your app, you need javascript. Infact, I dont think in this time and age a website is done without an element of javascript included.

it’s awesome but it can be a nightmare (most of the time :pensive: )

Wonderful explanation, @Hafiz. You must be a great teacher :smile:

1 Like

Chairman @Emeka please do not bug your brain… just learn jquery then later in development, javascript will bounce it way to your head when you need it the most.

1 Like

Javascript, jQuery and Javascript libraries such as (Backbone.js, Angular.js, Ember.js, React.js) are very important in building web-applications.

2 Likes

What about Php?

Learn it as long as it’s not WP

1 Like

Javascript is really not needed if all you need is a very simple web pages.

But if you want to build a great website, then you will need it.

I won’t explain any reasons here because the first two have done great with that.

It will be great if you know how to use it. :slight_smile:

unless you are building a porn site, you need JS

The commenting system on youporn.com now uses JS if I recall correctly.

3 Likes

Even if you are building a local porn website like naijaporntube.com… you still need JS

Is Javascript really needed? No. You can build a lot (but obviously not everything) without JS. Even ‘great’ websites. It is an enhancement.

Now if you want interactivity and a nicer user experience, then yes.

This is an old topic but I would always advise frotend people to learn to build sites that are at least readable without javascript. Too much of the internet becomes completely useless when some JS script doesn’t load properly.

3 Likes

well comment can still happen without JS, but JS would enhance it, porn sites just need pictures, remember those WAP Porn sites back then.

No I don’t :grinning:! But you can ask our resident ‘expert’ below…he might recall

Actually if one does a search for [quote=“abiodun, post:16, topic:646”]porn
[/quote] you will find @Tola and @xolubi can be co-founders of a hot startup

2 Likes

Well said!!