1/10 Days Of Javascript

1/10 Days Of Javascript

Table of contents

No heading

No headings in the article.

In the professional developer world, Javascript is the most popular language so far. Due to its speed, simplicity, widespread community and a variety of reasons it is the number one choice for both new and old developers. It is primarily used to make web-based applications, some prime examples being Netflix and Uber. However, it's much bigger than the web browser. It's something that every computer has and so you don't have to download or install anything extra

Getting started with Javascript is pretty easy since your web browser already has one. Open your web browser. Right-click and select Inspect. 1in.jpg

Now don't overwhelm by the Interface. You'll be in the Element tab by default. 2ins.jpg

Check for the Console and click it.

Screenshot from 2022-09-14 00-42-05.png

This is where we'll experiment with the javascript in the web browser. Aside from the basic arithmetic operations javascript can perform a variety of tasks including storing value in memory. Type the following in the console

let myNumber = 6

Congratulations! you have just stored the number 6 in memory but rather than just calling out 6 you can now type the keyword myNumber and perform operations with it; even use it in code. Let's see one example:

20 + myNumber

Now if you enter the above code snippet in the console it will give the result 26 because myNumber has a value of 6. Not just numbers you can store just about anything logical in your memory including your name. But do remember that to store any form of a string or even paragraphs you'll need to use the quotes ' '.

let myName = 'Parikshit'

Here, 'myName' and 'my Number' are known as variables and are used to store any kind of values. If you assign a new value to these existing variables then the older one will get over-written.

On the other hand, if you try to add two numeric values inside quotes then the results would be somewhat different.

'2' + '2'

Rather than the actual answer 4, the console will give us the result as "22", which doesn't make any sense. Well, this is because anything written in between quotes is treated as a string and not the actual value itself (in this case numbers).

These were the variables that we manipulated but the browser itself stores a tonne of values such as the name of the webpage, title, etc. Let's see an example. in order to access the name of the webpage that you are visiting just type in the console the following code:

document.title
"Google"

We can use the above information to manipulate the data inside the webpage. To change the value of the webpage just feed it a new string

document.title = 'Parikshit'

Now once you press enter you'll see that the title of the webpage has been changed. And that's it here ends day one of javascript.

Screenshot from 2022-09-14 02-31-50.png

Did you find this article valuable?

Support Parikshit Hiwase by becoming a sponsor. Any amount is appreciated!