{"id":1547,"date":"2023-10-31T17:19:21","date_gmt":"2023-10-31T17:19:21","guid":{"rendered":"https:\/\/matob.web.id\/random\/?p=1547"},"modified":"2023-10-31T17:19:21","modified_gmt":"2023-10-31T17:19:21","slug":"javascript","status":"publish","type":"post","link":"https:\/\/matob.web.id\/random\/javascript\/","title":{"rendered":"What is Javascript? Functions, Benefits and How it Works"},"content":{"rendered":"<p>For those of you who have never been in the programming world, you must be wondering,\u00a0<em>what is JavaScript<\/em>\u00a0?\u00a0<a href=\"https:\/\/matob.web.id\/random\/technology\/javascript\"><strong>JavaScript<\/strong><\/a>\u00a0is one of the most widely used programming languages \u200b\u200bin the last twenty years.\u00a0In fact, this programming language is one of the most important for web developers, including:<\/p>\n<ol>\n<li>HTML: Allows you to add content to web pages.<\/li>\n<li>CSS: Determines the layout, style, and alignment of web pages.<\/li>\n<li>JavaScript: Improves the appearance and system of web pages.<\/li>\n<\/ol>\n<p>You can\u00a0<strong>learn<\/strong>\u00a0this\u00a0<strong>programming language<\/strong> quickly and easily, and use it for a variety of purposes, from enhancing website functionality to enabling web-based games and software. Plus, there are thousands of JavaScript templates and apps that you can use for free and all this thanks to sites, like <a href=\"https:\/\/matob.web.id\/random\/technology\/github\/\">GitHub<\/a>.<\/p>\n<h2>JavaScript History<\/h2>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"size-full wp-image-1574 aligncenter\" src=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/12\/JS-LOGO.png\" alt=\"JAVASCRIPT\" width=\"480\" height=\"480\" title=\"\" srcset=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/12\/JS-LOGO.png 480w, https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/12\/JS-LOGO-60x60.png 60w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/><\/p>\n<p>The process of preparing and designing JavaScript took only ten days by <a href=\"https:\/\/en.wikipedia.org\/wiki\/Brendan_Eich\" target=\"_blank\" rel=\"noopener\"><strong>Brandan Eich<\/strong><\/a>, a Netscape employee, in September 1995. Initially, the name of this programming language was Mocha, then it became Mona, then LiveScript before finally bearing the name JavaScript.\u00a0The first version was only used among Netscape, with limited functionality.\u00a0However, this language continues to be developed by a community of developers who always use this programming language.<\/p>\n<p>In 1996, JavaScript officially became ECMAScript.\u00a0The release of ECMAScript 2 then followed in 1998, and ECMAScript 3 in 1999. ECMAScript was developed to eventually become the JavaScript we know today.\u00a0Not only cross-browser, this language can also work on various devices, including mobile devices and computers.<\/p>\n<p>Since then, JavaScript has continued to grow and develop.\u00a0In the end, in 2016, 92% of websites used this programming language.\u00a0In just twenty years, this language has gone from a very limited and &#8216;primitive&#8217; programming language to one of the most important tools for web developers.\u00a0If you often spend time surfing the internet, you must have often heard the name of this programming language.<\/p>\n<h2>Advantages of JavaScript<\/h2>\n<p><img decoding=\"async\" class=\"size-full wp-image-1575 aligncenter\" src=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/12\/Javascript-Code.jpg\" alt=\"Javascript Code\" width=\"1290\" height=\"860\" title=\"\" srcset=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/12\/Javascript-Code.jpg 1290w, https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/12\/Javascript-Code-768x512.jpg 768w\" sizes=\"(max-width: 1290px) 100vw, 1290px\" \/><\/p>\n<p>There are a number of advantages of JavaScript that make this programming language superior to its competitors, especially in certain cases.\u00a0Here are some of the advantages of JavaScript:<\/p>\n<ol>\n<li>You don&#8217;t need a compiler because web browsers can interpret it with HTML;<\/li>\n<li>Easier to learn than other programming languages;<\/li>\n<li>The process of finding and handling errors or errors is easier;<\/li>\n<li>Can function as web page elements or certain events, such as clicks or\u00a0<em>mouseovers<\/em>\u00a0;<\/li>\n<li>Can work on various browsers, platforms, and more.<\/li>\n<li>You can use this programming language to validate input and minimize the process of checking data manually;<\/li>\n<li>With it, your website becomes more interactive and also able to attract the attention of more visitors;<\/li>\n<li>Faster and lighter than other programming languages.<\/li>\n<\/ol>\n<h2>Disadvantages of JavaScript<\/h2>\n<p>Every programming language has some drawbacks.\u00a0One of the reasons is the growing popularity of the programming language you choose, including JavaScript in this case.\u00a0That popularity, unfortunately, invites hackers, scammers, and other malicious third parties to look for security holes.\u00a0Some of the shortcomings of JavaScript include:<\/p>\n<ol>\n<li>High risk of exploitation;<\/li>\n<li>Can be abused to activate malicious code on a user&#8217;s computer;<\/li>\n<li>Not all browsers and devices always support this programming language;<\/li>\n<li>JS code snippets are quite a lot;<\/li>\n<li>May render differently on each device which leads to inconsistencies.<\/li>\n<\/ol>\n<h2>How JavaScript Work and Function on Your Website<\/h2>\n<p><img decoding=\"async\" class=\"size-full wp-image-1576 aligncenter\" src=\"https:\/\/matob.web.id\/random\/wp-content\/uploads\/sites\/2\/2021\/12\/Java-Script.jpg\" alt=\"\" width=\"640\" height=\"426\" title=\"\"><\/p>\n<p>Usually, you can embed JavaScript directly into your web page or redirect it via your own .js file.\u00a0JavaScript is a\u00a0<em>client-side<\/em>\u00a0language\u00a0<em>,<\/em>\u00a0which means that the downloading and processing of scripts takes place on the devices of your site visitors.\u00a0As for\u00a0<em>server-side<\/em>\u00a0programming languages\u00a0<em>, this<\/em>\u00a0process occurs on the server before the programming language sends files to site visitors.<\/p>\n<p>You need to know, some web browsers also offer the opportunity for users to disable JavaScript.\u00a0So it&#8217;s a good idea to find out what happens to\u00a0<em>events<\/em>\u00a0that you download to devices that don&#8217;t even support them.<\/p>\n<h2 id=\"h-cara-kerja-javascript-dari-sisi-server\"><span id=\"Cara_Kerja_JavaScript_dari_Sisi_Server\">How JavaScript Work from the Server<\/span><\/h2>\n<p>Well, from the server side, this programming language is mostly implemented for database needs.\u00a0The way it works is almost the same as other server-side programming languages, such as C# or Java.<\/p>\n<p>However, the thing that makes the difference is that JavaScript works non-blocking.\u00a0It means.\u00a0When the program is running, the program will not stop at just one process.\u00a0The system will start preparing the next command.<\/p>\n<p>If the next process is found to have no output, the process can be run simultaneously with the process that is still running.\u00a0So, the data processing process can be done much more effectively.<\/p>\n<p>An example of how this works is the activity of streaming videos or embedding YouTube on a website.\u00a0As long as the video is running, you can still access other information on the website.<\/p>\n<h2>Why is JavaScript Different from Other Programming Languages?<\/h2>\n<p>The reason why JavaScript has become one of the most popular programming languages \u200b\u200bis its ease of learning and use.\u00a0Many developers even end up choosing JavaScript as the best programming language.\u00a0Other programming languages \u200b\u200bare only needed if the developer wants something more specific.<\/p>\n<p>Here are some of the most popular programming languages:<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>JavaScript<\/strong><\/td>\n<td>The function of JavaScript, or what is often abbreviated as JS, is to make websites more interactive.\u00a0These programming language scripts run in the browser, not the server, and usually go into third-party libraries to provide advanced functionality without requiring developers to\u00a0<em>code<\/em>\u00a0from scratch.<\/td>\n<\/tr>\n<tr>\n<td><strong>HTML<\/strong><\/td>\n<td>It stands for Hypertext Markup Language, and is one of the most common programming languages \u200b\u200bon the web and forms the building\u00a0<em>blocks<\/em>\u00a0of web pages.\u00a0For example, HTML tags include &lt;p&gt; for paragraphs and &lt;img&gt; for images.<\/td>\n<\/tr>\n<tr>\n<td><strong>PHP<\/strong><\/td>\n<td>PHP is a server-side programming language, while JavaScript is client-side.\u00a0This language is often seen in PHP-based content management systems, such as WordPress, but is also often used for\u00a0<em>back-end<\/em>\u00a0development\u00a0because it provides the best way to facilitate the transfer of information to and from databases.<\/td>\n<\/tr>\n<tr>\n<td><strong>CSS<\/strong><\/td>\n<td>CSS stands for Cascading Style Sheets.\u00a0With CSS, webmasters can style and determine the appearance of each type of content.\u00a0To display content, you can do this manually for each element in the <a href=\"https:\/\/matob.web.id\/random\/technology\/java\/\">HTML<\/a>.\u00a0However, if you do it in CSS, you don&#8217;t have to repeatedly define the appearance of the elements each time you use them.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Let&#8217;s say we are building a house.\u00a0HTML is the structure of the house building and the support for the doors and walls, while CSS is the carpet and wallpaper that decorates every corner of the house so that it looks more beautiful and attractive.\u00a0JavaScript, in this case, adds responsiveness so you can open the door and turn on the light.\u00a0You may not use a light or you may not need a door.\u00a0However, the risk is a dark and outdated house, like a building that has been around since 1995. This is the same as when you use JavaScript for a webiste.<\/p>\n<h2>How to Create JavaScript on a Website?<\/h2>\n<p>To insert a string of JavaScript code into a webpage, you must use the &lt;script&gt; tag.\u00a0You can also take a look at the example below to check how it looks:<\/p>\n<pre>\t&lt;script type=\"text\/javascript\"&gt;Your JavaScript code&lt;\/script&gt;\r\n<\/pre>\n<p>It&#8217;s a good idea to include JavaScript in the &lt;header&gt; tag for your site, unless it&#8217;s a language you need to run at a certain time or with certain web page elements.\u00a0You can also save the JavaScript code as a separate file, and you can &#8216;call&#8217; it if you need it on the website.<\/p>\n<h2>JavaScript Guide for Beginners<\/h2>\n<p>Here is a JavaScript learning guide for beginners that you can follow:<\/p>\n<h3>1. Know the Applications Required<\/h3>\n<p>In this chapter, we will provide a short guide to Javascript for beginners that you can learn.\u00a0However, before that you need the following applications to support you in learning Javascript:<\/p>\n<ul>\n<li><strong> Web browser <\/strong> (Google Chrome, Firefox, or others).<\/li>\n<li><strong> Text editor <\/strong> (Atom, Notepad, or others).<\/li>\n<li><strong> Web server <\/strong> , to run programming code.<\/li>\n<\/ul>\n<h3>2. Understand the Code Writing Rules<\/h3>\n<p>If you have prepared the application above, then understand the rules of writing js code.\u00a0This writing rule is important for you to know to be able to run programs with this <a href=\"https:\/\/matob.web.id\/random\/technology\/java\/\">programming language<\/a>.\u00a0Well, here are some rules for writing the code.<\/p>\n<ul>\n<li><strong> Embed <\/strong> Writing \u2013 <strong> Embed <\/strong> writing uses the <strong> &lt;script&gt; <\/strong> tag\u00a0to insert JavaScript code into html, precisely in the &lt;body&gt; or &lt;head&gt; tags.<\/li>\n<li><strong> External Line <\/strong> \u2013 If previously the writing was pasted in HTML, in this type of writing it is created in a separate file stored in the web server folder.<\/li>\n<li><strong> Case Sensitivity <\/strong> \u2013 Writing the code must also pay attention to capital letters and lowercase letters.\u00a0Because, the two could be different variables.<\/li>\n<li><strong> Character Writing <\/strong> \u2013 Writing code will ignore characters that use spaces, enter and tabs.\u00a0However, the ending of each line sometimes requires a sign (;) to get the desired result.<\/li>\n<\/ul>\n<h3>3. Know the Use of JavaScript Variables<\/h3>\n<p>Knowing variables will help you learn programming languages.\u00a0Simply put, a variable is a name that will represent a value.\u00a0Well, this variable can be filled with various values.<\/p>\n<p>In JavaScript, creating a variable starts with the var keyword and is followed by the variable name and value.<\/p>\n<pre><code>\r\n\t\tvar title = \u201cLearning Javascript For Beginner\u201d;\r\n\t<\/code><\/pre>\n<p>In the example above, we created a variable named title which contains a value in the form of the text \u201cLearn Javascript for Beginners\u201d.<\/p>\n<pre><code>\r\n\t\tVar url = \u201chttps:\/\/yourwebsite.com\u201d;var visitor_count = 12345;&amp;nbsp;\r\n\t<\/code><\/pre>\n<p>So, in the example above, we create url and visitor_count variables with values \u200b\u200bin the form of text, and also number.<\/p>\n<p>From the examples above, each variable will be separated by a semicolon.\u00a0Writing variable names also does not use spaces.\u00a0If you use two words, you can use an underscore or capital letters.<\/p>\n<h3>4. Tipe data JavaScript<\/h3>\n<p>Now, after getting to know variables in this programming language, you also need to know the type of data to be stored in variables.<\/p>\n<p>There are several data types in Javascript:<\/p>\n<ol>\n<li>String or text<\/li>\n<li>Integer or Number is an integer<\/li>\n<li>Float is a fractional number<\/li>\n<li>Boolean berupa (true\/false)<\/li>\n<li>Objects of all data types<\/li>\n<\/ol>\n<p>This JavaScript is actually dynamic typing.\u00a0This means, you don&#8217;t have to write the data type when filling in the variables like in other programming languages.<\/p>\n<h3>5. Operator<\/h3>\n<p>Next, you need to understand what operators are in JavaScript.\u00a0Well, the operator here means a symbol that can produce a new value.\u00a0Here are the operators you can use in JavaScript:<\/p>\n<ul>\n<li><strong> Arithmetic Operators <\/strong> \u2013 Symbols used to calculate the value of a number variable.\u00a0Consists of symbols for <strong> addition (+), subtraction (-), multiplication (*), power (**), pision (\/) <\/strong><\/li>\n<li><strong> Assignment Operators <\/strong> \u2013 Used to assign assignments to variables, such as <strong> assigning <\/strong> values \u200b\u200bto variables.\u00a0One of the assignment symbols is <strong> (=) <\/strong> .<\/li>\n<li><strong> Comparison Operators <\/strong> \u2013 Relational or comparison operators are operators used to compare two values.\u00a0Well, the result of this comparison will produce boolean values \u200b\u200b&#8217;true&#8217; and &#8216;false&#8217;.\u00a0These operator symbols include, <strong> (&gt;), (&lt;), (&gt;=) <\/strong> , and so on.<\/li>\n<li><strong> Logical Operators <\/strong> \u2013 Finally, logical operators.\u00a0This operator is used to perform operations on boolean values.\u00a0The symbols for these operators are logical AND (&amp;&amp;), logical OR (||), and negation (!)<\/li>\n<\/ul>\n<h2>So, What is JavaScript?<\/h2>\n<p>Talking about understanding JavaScript is very easy.\u00a0JavaScript is a programming language that makes your website more lively and attractive.\u00a0This language is different from HTML (which manages the content) and CSS (which manages the layout).\u00a0Different from\u00a0<strong>PHP<\/strong>\u00a0, this programming language runs on the devices of your site visitors and not on the server.<\/p>\n<p>Things you should know about JavaScript:<\/p>\n<ol>\n<li>The process of learning JavaScript is easiest than any other programming language;<\/li>\n<li>Developed by Netscape and to date 92% of websites have used it;<\/li>\n<li>Can function as a specific web page element or\u00a0<em>event<\/em>\u00a0, such as a click;<\/li>\n<li>You can use it on various browsers and devices;<\/li>\n<li>Faster and lighter than other programming languages;<\/li>\n<li>Less secure than other programming languages \u200b\u200bdue to their growing popularity;<\/li>\n<li>You can create JavaScript directly in the HTML or save it in a separate file and then use the function when you need it.<\/li>\n<\/ol>\n<p>In the end you now know why this programming language is so popular: it has many advantages over other programming languages.\u00a0Hopefully this article can answer your questions about what JavaScript is and its functions and how it works.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For those of you who have never been in the programming world, you must be wondering,\u00a0what is JavaScript\u00a0?\u00a0JavaScript\u00a0is one of the most widely used programming languages \u200b\u200bin the last twenty years.\u00a0In fact, this programming language is one of the most important for web developers, including: HTML: Allows you to add content to web pages. CSS: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1573,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[174,166],"class_list":["post-1547","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","tag-coding","tag-programming"],"_links":{"self":[{"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/posts\/1547","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/comments?post=1547"}],"version-history":[{"count":1,"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/posts\/1547\/revisions"}],"predecessor-version":[{"id":2479,"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/posts\/1547\/revisions\/2479"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/media\/1573"}],"wp:attachment":[{"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/media?parent=1547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/categories?post=1547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matob.web.id\/random\/wp-json\/wp\/v2\/tags?post=1547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}