21st November 2024

What is JavaScript? Some JavaScript Keywords

One of the most popular and functional programming languages ​​today is JavaScript. This scripting language, which is actively used in web browsers, makes the web page more dynamic in itself, as well as allowing the browser to interact with the user. Because of name similarities, Java and JavaScript are constantly being confused with each other. Apart from some common features, the semantic structures of these two languages ​​are completely different from each other.

What is JavaScript?

JavaScript is widely used in web designs, code structures of browsers, mobile applications, and the construction of most games. There is no limit to what can be done with this scripting language, it depends on your creativity and the code you write. It enables the perfection of websites to be made more dynamic. It works user-side or server-side. Thanks to the written JavaScript codes, the browser can communicate with the user. In addition, the control of the browser can be provided, and the content of the web page can be changed by contacting the server. JavaScript functionality is a very high script language. User and server-side are also widely used.

JavaScript was developed and launched in 1995 by Brendan Eich. This software language, which was named Mocha at first, was later replaced with LiveScript and lastly with JavaScript. The language developed by Eich, a Netscape employee, initially had limited functionality, but over time it continued to develop and grow with the help of the developer community.

Brendan Eich is also the co-founder of the Mozilla project and the Mozilla foundation and company. Currently, JavaScript is developed and maintained by the Mozilla foundation. Since 2016, JavaScript has been a software language used on 92% of websites. Achieving rapid and great success in such a short time makes JavaScript one of the most preferred software languages.

LEARN MORE  .net 3.5 Installation Error And Solition - 0x800f0954

We have said that JavaScript makes websites more dynamic and enables communication with the user. As an example of this, JavaScript opens a dialogue in the middle of the web page. “Are you sure you want to buy?” or “This operation cannot be performed” warnings.

JavaScript
JavaScript

 

How to Use JavaScript Codes?

JavaScript is one of three software languages ​​that every web designer should learn. First; HTML, the second; CSS and the third is JavaScript. HTML: defines the content of web pages. CSS: determines the layout and layout of web pages. JavaScript: programs the movements of web pages. The extension of JavaScript files shows itself as .js at the end of the file.

There are certain basic codes for defining each software language. To define JavaScript, all you need to do is use <script> </script> tags. The codes you add should be in this tag. JavaScript codes can be added to <head> and <body> sections. JavaScript codes can have different loading speeds depending on where you add it in your HTML file. Generally, the recommended practice is to add your code to the <head> section. This way, the codes will stay separate from your original HTML file. However, adding the codes to the <body> section will increase the page loading speed. Since the JavaScript codes will be easily resolved, the site loading speed will be faster.

To give an example: <script> alert (“You are logging into the page”); Suppose you wrote </script>. When your page is opened, a warning “You are logging in to the page” will appear. For another example: You can also use Javascript to send a message when clicked somewhere. <button onclick = “alert (” Yes! You won! “)”> Click and Win </button>, this message will appear when the button is clicked.

LEARN MORE  Html input type Properties with Examples

JavaScript, modify, copy, delete HTML objects and add new HTML objects. In short, it provides a more dynamic use of HTML. That’s why you need to know HTML to be able to use JavaScript. All browsers support JavaScript. You don’t need to do anything to activate it.

History of JavaScript

The creator of Javascript is Netscape employee Brendan Eich. Javascript language started to be used in 1997. When it first came out, the question of what is Javascript was a very curious question. The reason was that most of the browsers of that day could not interpret javascript yet. However, the JavaScript language has continued to be developed from then to today. Brendan Eich also founded the Mozilla Foundation, which continues to develop the JavaScript language.

Calling a JavaScript File in HTML

Adding JavaScript codes to our web page is just like adding CSS. In the same way as calling a CSS file in HTML, we can also call our JavaScript files or write JavaScript code directly into HTML.

<script type = "text/javascript" src ="DIRECTORY WITH JAVASCRIPT"> </script>

The above method includes the .js extension file into our project and allows you to run the JavaScript codes in the file. Another method is to write JavaScript codes directly into the HTML file. This happens as follows:

<script type = "text / javascript">

...
JAVASCRIPT CODES
...

</script>

How to Use JavaScript Codes from File?

It is also possible to create a JavaScript file and use it by calling it from your HTML document. In this way, your codes will not look complicated, they will have a simpler appearance. To do this, you need to add src = ”” to the <script> code and type the file name according to the main directory. For example, the name of your file: script.js. The code you will write will look like this: <script src = “script.js”> </script>

LEARN MORE  What is CSS and How is it Written?

Some JavaScript Keywords

Keywords are used to describe the JavaScript actions to be performed. Some of the frequently used keywords are as follows.

Break: Terminates a selection or loop.
Continue: Allows you to exit the loop and start over.
Debugger: Terminates the execution of JavaScript and gives debug command.
Function: Declares a function.
Return: Exits a function.
Var: Defines a variable.

JavaScript Editors

There are many editors available for creating and editing JavaScript. The most frequently used and free of these are Notepad ++ and Sublime Text editors. Click here to download Notepad ++.

Notepad ++
Notepad ++

 

Click here to download Sublime Text.

 Sublime Text
Sublime Text

 

Leave a Reply

Your email address will not be published. Required fields are marked *