DEV Community

YoonSL
YoonSL

Posted on

Why HTML is important for web developing

The first web-page displaying language I have learned is HTML. Many of people would think HTML is a really easy language to learn and understand, and I also think the same, but HTML is like addition and subtraction we learn in kindergarten. Without knowing how to use the basic operations of math, we would not be able to do any kind of other higher mathematics problems. Just like the basics of mathematics, HTML is the basics of web developing and always needed.

Why is HTML always needed? If I was creating a web-site using JavaScript and a empty HTML page. I would be able to render out the display to the web-page without writing anything to the HTML(except for ,

and ),but even if we are using JavaScript, we would still need to know the HTML syntax to create HTML displays.

Example Code:

alt text

Example Display:

alt text

So on the example code, adding a HTML syntax to a variable and appending it to the div that was created in body is one of the ways to display on web-page using JavaScript. With this JavaScript code, The web page is displayed just like it was created in HTML.

There is one more different example for this written in different way.

Example Code:

alt text

Example Display:

alt text

The code in JavaScript is written in different way, but the outcome is the same. I do not know all of the differences these codes might consist, but I prefer the second way more. It just looks cleaner and more readable to me.

So the point for showing and explaining these codes were to emphasize that the HTML syntax is the basics of HTML-JavaScript web-development and is the basic essentials that must be mastered.

Top comments (1)

Collapse
 
tux0r profile image
tux0r

The JavaScript code is unnecessarily verbose, because you create a method render() and call it afterwards. You don't need to wrap the lambda function in a const render.

Also, the JavaScript code will still need a HTML wrapper with a <script> tag to do anything.

Also, it will not work like that because you seem to use jQuery (or compatible DOM libraries), not pure JavaScript. I advise you to start with Vanilla JS instead. You won't always have jQuery.

Also, HTML markup is (technically) not required. This is a valid "website":

Foo bar baz quux

Copy the four "words", save them as "myfile", open "myfile" in your web browser. It will be displayed. Unformatted though.