
{"id":4660,"date":"2018-11-12T12:00:00","date_gmt":"2018-11-12T11:00:00","guid":{"rendered":"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/uncategorized\/introduction-to-javascript\/"},"modified":"2023-08-30T14:08:32","modified_gmt":"2023-08-30T12:08:32","slug":"introduction-to-javascript","status":"publish","type":"post","link":"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/introduction-to-javascript\/","title":{"rendered":"Introduction to JavaScript: The Ideal Beginner's Guide"},"content":{"rendered":"<p><strong>Anyone with half an interest in coding knows how important it is, but what is JavaScript used for? How did it get to be that way? <\/strong><\/p>\n<p><strong>L<\/strong><strong>earn all about one of the three pillars of the internet.<\/strong><\/p>\n<p>If you\u2019re currently learning web development (or thinking about it), there\u2019s no doubt you\u2019ve heard of JavaScript.<\/p>\n<p>It\u2019s a very popular programming language that started out for web browsers but evolved into much more\u2014which means that, if you\u2019re considering a career in web development, getting to know the language\u00a0is absolutely essential.<\/p>\n<p>In this guide, I\u2019m going to introduce you to JavaScript on the frontend, as well as explaining briefly how it works on the backend as well.<\/p>\n<p>I\u2019ll also provide some mini JavaScript tutorials to show you this versatile programming language in action. If you&#8217;re wondering <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/should-you-learn-javascript\/\">if you should learn JavaScript<\/a>, then this article should help show all you can do with it.<\/p>\n<p>If you&#8217;d like to skip ahead to a particular section, simply use the table of contents:<\/p>\n<ol>\n<li><a href=\"#the-evolution-of-javascript-a-brief-history\">The evolution of JavaScript: A brief history<\/a><\/li>\n<li><a href=\"#what-is-javascript-used-for-on-the-frontend\">What is JavaScript used for on the frontend?<\/a><\/li>\n<li><a href=\"#what-is-javascript-used-for-on-the-backend\">What is JavaScript used for on the backend?<\/a><\/li>\n<li><a href=\"#popular-javascript-frontend-frameworks\">Popular JavaScript frontend frameworks<\/a><\/li>\n<li><a href=\"#javascript-for-beginners-key-takeaways\">JavaScript for beginners: Key takeaways<\/a><\/li>\n<\/ol>\n<h2 id=\"the-evolution-of-javascript-a-brief-history\">1. The evolution of JavaScript: A brief history<\/h2>\n<p>The JavaScript we know today has been around for well over two decades.<\/p>\n<p>Created by Brendan Eich in 1995, it started out as a language that developers could utilize to make applications in the browser more interactive (think real-time updates to your to-do list application).<\/p>\n<p>So briefly, what is JavaScript used for? The answer is constantly changing.<\/p>\n<p>Since its beginning, it has evolved from a purely frontend language (a language that runs in the browser) to one that can be used for the \u201cfull stack\u201d (browser + server). This means that, these days, it&#8217;s possible to create an entire web application without having to learn the syntax of other backend programming languages like Java or <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/should-i-learn-ruby-on-rails\/\">Ruby<\/a>.<\/p>\n<p>For this reason and others, developers fluent in this language can command a hefty wage, <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/javascript-developer-salary-guide\/\">as our JavaScript developer salary guide shows<\/a>.<\/p>\n<p>However, JavaScript has further evolved into a language that can be used for much more than web applications. It can also be used in testing software applications, it can be used in databases, and it is even being used for IOT (Internet of Things) solutions.<\/p>\n<p>Due to this evolution, it has become a very versatile programming language and, arguably, one of the most useful to know these days.<\/p>\n<p>You can <a href=\"\/en\/blog\/web-development\/whats-the-difference-between-frontend-and-backend\/\">read more about the differences between frontend and backend development in this guide<\/a>.<\/p>\n<h2 id=\"what-is-javascript-used-for-on-the-frontend\">2. What is JavaScript used for on the frontend?<\/h2>\n<p>JavaScript was originally intended to run in the browser.<\/p>\n<p>Most major browsers have a built-in \u201cJavaScript reader\u201d called a JavaScript engine that reads JavaScript code and interprets it. The browser then acts according to the \u201cinstructions\u201d, whether it be to change the text of an element on the screen or to take a number from a user, calculate the square of it, and display the result in the browser (among many other things).<\/p>\n<p>Here\u2019s how it works: When the browser reads your <a href=\"\/en\/blog\/web-development\/what-is-html-a-beginners-guide\/\">HTML<\/a> file, the file is read line-by-line. Each line is interpreted in order from top to bottom.<\/p>\n<p>It renders the HTML code to the screen exactly as it interprets it from your HTML file. When it hits some JavaScript, it runs the JavaScript code in its entirety before continuing on down the page.<\/p>\n<h3 id=\"using-javascript-to-replace-text-on-a-page\">Using JavaScript to replace text on a page:<\/h3>\n<p><img decoding=\"async\" title=\"A screenshot showing JavaScript being used to replace text on a page\" src=\"\/en\/wp-content\/uploads\/old-blog-uploads\/js-post-first-screen-shot.png\" alt=\"A screenshot showing JavaScript being used to replace text on a page\" \/><\/p>\n<ul>\n<li>Line 17 renders the header.<\/li>\n<li>Line 19 renders the paragraph that won\u2019t be changed.<\/li>\n<li>Line 21 renders the paragraph that will be changed.<\/li>\n<li>Line 23 is the JavaScript that grabs the second paragraph and changes its text.<\/li>\n<\/ul>\n<p>The image above shows the page after the JavaScript has been run to change the second paragraph. That is why you see that \u201cHello from JavaScript!\u201d has replaced \u201cThis paragraph will be changed by JavaScript below\u201d.<\/p>\n<p>Here\u2019s an example of some more complicated JavaScript code that takes a number from a user, calculates the square of that number, and displays the answer on the screen.<\/p>\n<h3 id=\"using-javascript-to-calculate-and-display-some-simple-math\">Using JavaScript to calculate and display some simple math:<\/h3>\n<p><img decoding=\"async\" title=\"A screenshot showing how JavaScript can be used to calculate and display a simple math problem\" src=\"\/en\/wp-content\/uploads\/old-blog-uploads\/js-post-second-screen-shot.png\" alt=\"A screenshot showing how JavaScript can be used to calculate and display a simple math problem\" \/><\/p>\n<ul>\n<li>Line 17 renders the input box so the user can input the number.<\/li>\n<li>Line 19 renders the sentence into which the answer will be rendered.<\/li>\n<li>Line 21 renders the button the user will click after entering a number to get the answer.<\/li>\n<li>Line 25 basically says: \u201cRun the stuff in the code block below me when a user clicks on the GO button.\u201d<\/li>\n<li>Line 26 grabs the number input by the user and assigns it to a variable (to be reused later).<\/li>\n<li>Line 27 calls the pre-written function below (\u201ccalculateSquare\u201d) and assigns the answer to another variable.<\/li>\n<li>Lines 28 and 29 populate the paragraphs with the correct values.<\/li>\n<li>Lines 32 -34 define the function that will calculate the square and return the answer.<\/li>\n<\/ul>\n<p>The image above shows the results of clicking \u201cGO\u201d after entering 12 in the input box.<\/p>\n<p>If you want to see a further introduction to frontend coding with JavaScript, this video tutorial from our in-house frontend developer Abhishek gets you started out with some simple concepts:<\/p>\n<style>.embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }<\/style>\n<div class=\"embed-container\"><iframe src=\"https:\/\/www.youtube.com\/embed\/-4jokJpvFwc\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<div><\/div>\n<p>So, now that we have a fair idea of the things it can do on the client side, it&#8217;s time to take a look at what JavaScript is used for on the backend.<\/p>\n<h2 id=\"what-is-javascript-used-for-on-the-backend\">3. What is JavaScript used for on the backend?<\/h2>\n<p>Although JavaScript was originally made for browsers, it has evolved into a full-stack programming language that can sit on a server and process requests from browsers.<\/p>\n<p>It&#8217;s become sophisticated enough to handle just about anything that other backend languages can.<\/p>\n<p>The transition of JavaScript from a frontend language to a full-stack language was a major milestone for the web development community. <strong>It is now possible to develop <a href=\"\/en\/blog\/web-development\/what-is-the-difference-between-a-mobile-app-and-a-web-app\/\">web applications<\/a> with JavaScript alone<\/strong>. This fact alone makes it a great choice for beginners because it cuts syntax study effort in half, allowing the new developer to get apps up and running in less time.<\/p>\n<p>Check out <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/what-is-nodejs\/\" target=\"_blank\" rel=\"noopener\" data-schema-attribute=\"\">our article all about Node.js<\/a> if you want a beginner&#8217;s introduction into what JavaScript is used for in the backend. Moving our attention back to the frontend, let&#8217;s take a look at some common web frameworks used to make it happen.<\/p>\n<h2 id=\"popular-javascript-front-end-frameworks\">4. Popular JavaScript frontend frameworks<\/h2>\n<p>The three most popular frontend JavaScript technologies today are <strong>Angular<\/strong>, <strong>React<\/strong>, and <strong>Vue<\/strong>.<\/p>\n<p><strong>Note:<\/strong> When developers say \u201cAngular\u201d, we usually mean the new version of Angular (currently Angular 14). The \u201cold\u201d Angular, AngularJS, is falling out of popularity, but is still relevant as many applications built in the past continue to run on it. These two frameworks (Angular and AngularJS) are very different, and most developers consider them to be different frameworks altogether, despite sharing a name.<\/p>\n<p>Also be sure to note that with AngularJS, you\u2019ll write pure JavaScript, but with Angular 2 and after, you\u2019re encouraged to use <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/learn-typescript\/\" target=\"_blank\" rel=\"noopener\"><strong>TypeScript<\/strong><\/a>. This is a different language altogether, that gets converted to JavaScript (although technically you can use pure JavaScript, though it\u2019s not recommended).<\/p>\n<h3 id=\"a-side-note-on-libraries-vs-frameworks\">A side note on libraries vs. frameworks<\/h3>\n<p>When talking about these three technologies, you\u2019ll hear the words \u201cframework\u201d and \u201clibrary\u201d quite often. Let\u2019s define what each of these terms mean.<\/p>\n<p>Both libraries and frameworks are basically a bunch of code that someone else wrote that we can tap into and use to develop applications. However, there are some distinct differences between the two:<\/p>\n<h4>Libraries<\/h4>\n<p>A library is reusable pre-written code (functions, objects, <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/javascript-classes\/\" target=\"_blank\" rel=\"noopener\">JavaScript classes<\/a>) that you can utilize anywhere in your application.<\/p>\n<p>You, the developer, are in control of the flow of the application; where and when you want to tap into that pre-written code is up to you.<\/p>\n<p>You can learn more about what they are in our <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/programming-library-guide\/\" target=\"_blank\" rel=\"noopener\">beginner&#8217;s guide to programming libraries<\/a>.<\/p>\n<h4>Frameworks<\/h4>\n<p>A framework, on the other hand, is pre-written code that suggests a defined structure that, should you follow it, allows for more efficient and easy-to-read code bases.<\/p>\n<p>The framework is in control of the flow. You put your code in the right spot and the framework takes care of how the application runs. With frameworks, you can also tap into useful pre-written features\u2014just like you can with libraries.<\/p>\n<p>If you&#8217;re looking to learn more, we&#8217;ve created a full <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/responsiveness-with-a-front-end-framework\/\">beginner&#8217;s guide to web frameworks<\/a>.<\/p>\n<h4>Which are which?<\/h4>\n<p>Most people would consider Angular and Vue as frameworks, but there\u2019s a lot of debate on <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/what-is-reactjs\/\" target=\"_blank\" rel=\"noopener\">whether React is a framework or a library<\/a>. Another example of this is something like<a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/what-is-npm\/\" target=\"_blank\" rel=\"noopener\"> npm (Node Package Manager)<\/a>, which is considered a JavaScript library as well as a package manager.<\/p>\n<p>All semantics aside, whether you want to call them libraries or frameworks, these three technologies are ultimately a whole pile of JavaScript code written by others that helps make web development easier for us. All we have to do is bring in the code to our applications and we can start utilizing all the pre-written features!<\/p>\n<h3 id=\"angularjs-react-and-vue-in-action\">AngularJS, React, and Vue in action<\/h3>\n<p>Take a look at what kind of great, pre-written functionality you can get with these three technologies!<\/p>\n<p><strong><a href=\"https:\/\/codepen.io\/joe-watkins\/pen\/EagEWv\" target=\"_blank\" rel=\"noopener\">A sample search bar utilizing AngularJS<\/a>:<\/strong><br \/>\nWith this sample app, you can \u201csearch\u201d for US States. Try entering \u201ca\u201d in the search box. It will immediately filter the list down to all states that contain the letter \u201ca\u201d. Now type \u201cl\u201d. Now you should see a list of all states that contain the letter combination \u201cal\u201d. Cool, huh?<\/p>\n<p>Angular helps to make programming this type of functionality very easy. Not only can Angular help us make cool things like this, it offers a structured approach to writing our code that helps us keep it neat and readable. It also helps minimize bugs that could make their way into our applications caused by using JavaScript by itself.<\/p>\n<p><strong><a href=\"https:\/\/codepen.io\/tbremer\/pen\/wKpaWe\" target=\"_blank\" rel=\"noopener\">A calculator application written with the help of React<\/a>:<\/strong><br \/>\nReact was created with speed, simplicity, and scalability in mind. You can use it to build large applications that can manipulate data without reloading the page (much like Angular).<\/p>\n<p>React can also be used in conjunction with other frameworks and it is known to be a bit easier for beginners to learn. In recent years, its popularity has skyrocketed, making it a solid choice if you\u2019re looking to add to your skill set.<\/p>\n<p><strong><a href=\"https:\/\/codepen.io\/Wyrlor\/pen\/ggmdKy\" target=\"_blank\" rel=\"noopener\">Take a simple app that uses Vue<\/a>.<\/strong> Type something into the input box and watch it render instantly below the line.<\/p>\n<p>Vue is also known to be a little easier than Angular to get started with\u2014making it another solid choice for those looking to expand their JavaScript studies into frameworks and beyond. It\u2019s great because it shares similar features with Angular, which in Vue\u2019s case is simple to use and means that data manipulation on the page happens automatically.<\/p>\n<p>This is beneficial by reducing coding effort and improving overall performance of the page. It\u2019s gaining in popularity very fast, so it\u2019s another great choice if you\u2019re looking to add a popular skill to your skill set that won\u2019t take a long time to master.<\/p>\n<p>At the moment whether you go with Angular, React, or Vue (or all of them), you can rest assured that it will be well worth your time. All three are solid technologies that will surely be around for the foreseeable future. In the <a href=\"https:\/\/survey.stackoverflow.co\/2023\/#section-admired-and-desired-other-frameworks-and-libraries\" rel=\"noopener\">2023 Stack Overflow Survey<\/a>, <strong>React topped the Most Desired chart for the third year running<\/strong>, just ahead of Node.js and Next.js.<\/p>\n<h2 id=\"javascript-for-beginners-key-takeaways\">5. JavaScript for beginners: Key takeaways<\/h2>\n<p>As you can see, a good answer to the question &#8220;What is JavaScript used for?&#8221; is most likely &#8220;What <strong>isn&#8217;t <\/strong>it used for!&#8221;<\/p>\n<p>Whether you want to be a frontend developer, a backend developer, or <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/what-is-a-full-stack-web-developer\/\" target=\"_blank\" rel=\"noopener\">a full-stack developer<\/a>, you\u2019re most likely going to be using JavaScript for something. Luckily there are lots of resources out there that can help you get started.<\/p>\n<p>The best thing to do is just get your hands dirty and start coding. Mess around with <a href=\"https:\/\/codepen.io\/\" target=\"_blank\" rel=\"noopener\">Codepen<\/a>\u00a0or take a short JavaScript for beginners course and have fun building something. When you\u2019ve got the basics down, try out a site like <a href=\"https:\/\/codesignal.com\/\" target=\"_blank\" rel=\"noopener\">CodeSignal<\/a> where you can use your new skills to solve real problems and even get coding interview practice.<\/p>\n<p>Next, consider signing yourself up to a <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/best-javascript-bootcamps\/\" target=\"_blank\" rel=\"noopener\">JavaScript bootcamp<\/a> to really hone those skills and learn how to use this language across the whole stack. It&#8217;ll take you well on your way to becoming a fully-fledged JavaScript developer.<\/p>\n<p>Whatever you decide to do, you can rest assured that it will be well worth your time and effort!<\/p>\n<h2 id=\"interested-in-becoming-a-web-developerhttpscareerfoundrycomencoursesbecome-a-web-developer\"><strong>Further reading<\/strong><\/h2>\n<p>If you&#8217;d like to read more about learning JavaScript, and web development in general, then these articles will be right up your street:<\/p>\n<ul>\n<li><a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/introduction-to-es6-javascript\/\">Why JavaScript ES6 and Its Successors Are So Great\u00a0<\/a><\/li>\n<li><a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/javascript-vs-jquery-whats-the-difference\/\">Key Differences Between jQuery and JavaScript: An Expert Guide<\/a><\/li>\n<li><a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/web-development\/reasons-to-learn-python\/\">What are the Advantages of Learning Python for Web Development?<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re an aspiring web developer, JavaScript is one of the most important programming languages you&#8217;ll need to master. Discover the ultimate introduction to JavaScript on the front end here.<\/p>\n","protected":false},"author":55,"featured_media":9437,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_lmt_disableupdate":"yes","_lmt_disable":"","footnotes":""},"categories":[5],"tags":[],"class_list":["post-4660","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-development"],"acf":{"homepage_category_featured":false},"modified_by":"Matthew Deery","_links":{"self":[{"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/posts\/4660","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/comments?post=4660"}],"version-history":[{"count":4,"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/posts\/4660\/revisions"}],"predecessor-version":[{"id":28606,"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/posts\/4660\/revisions\/28606"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/media\/9437"}],"wp:attachment":[{"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/media?parent=4660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/categories?post=4660"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/tags?post=4660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}