Computer Science
JavaScript
JavaScript is a high-level, interpreted programming language primarily used for creating interactive and dynamic content on websites. It is commonly used for client-side scripting to enhance user experience by enabling features like form validation, interactive maps, and dynamic content updates. JavaScript is supported by all major web browsers and is a fundamental technology for web development.
Written by Perlego with AI-assistance
Related key terms
1 of 5
10 Key excerpts on "JavaScript"
- eBook - PDF
- Patrick Carey, Sasha Vodnik, Patrick Carey(Authors)
- 2021(Publication Date)
- Cengage Learning EMEA(Publisher)
1 JavaScript is a programming language that adds complex interactive features to a website. Among its many applications, JavaScript can be used to validate data on web forms, generate new content in response to user actions, and store data that will persist from one web session to the next. JavaScript is an increasingly important tool for the website designer and programmer to create useful and powerful web applications. This chapter introduces the basics of JavaScript and its role in developing interactive websites. You will create a JavaScript program for use in a web page and explore browser tools for evaluating your code. Exploring the JavaScript Language Before discussing the details of JavaScript, this chapter will examine how JavaScript fits in with the develop- ment of the web as the primary source of sharing content and commerce across the globe. JavaScript had its origins in the mid-1990s with the creation of the World Wide Web or web, which was developed to share data across a network of linked documents. In its early years, the web was primarily used for academic research and did not require much more than the ability to share text and graphic images between researchers. The business world quickly recognized that the web could be a powerful tool for online commerce including the process of validating customer data. When JavaScript first appeared in 1995, it was used to handle as much of that validation as possible to speed up customer transactions. - No longer available |Learn more
The JavaScript Workshop
A New, Interactive Approach to Learning JavaScript
- Joseph Labrecque, Jahred Love, Daniel Rosenbaum, Nick Turner, Gaurav Mehla, Alonzo L. Hosford, Florian Sloot, Philip Kirkbride(Authors)
- 2019(Publication Date)
- Packt Publishing(Publisher)
Any introduction to JavaScript requires a foundational background of the history and origins of the language in order to move forward and achieve competency. This chapter introduces us to JavaScript, from its history to modern implementations. It also provides us with additional information on various uses of the language so that we can provide a proper context for what comes next.What Is JavaScript and How Is It Used?
JavaScript is a weakly-typed, multi-paradigm, event-driven, object-oriented programming language. It includes the ability to work with strings, dates, arrays, objects, and more. It is generally used on the client-side within web browser environments but can also be used in other environments such as servers and desktop applications. The runtime environment is very important for JavaScript—especially since it, by itself, does not include any networking, file, graphics, or storage capabilities on its own.JavaScript versus Other Languages
If you are approaching JavaScript with experience in other languages such as Java or Python, things might seem a bit odd. While many languages (such as Java) must be compiled to run, JavaScript is run exactly as-is and does not require this additional step.Though the language is used within many environments and for many purposes, JavaScript is fundamentally one of the three languages that are native to the web. The other two languages are the HTML semantic markup language and the CSS styling and layout language. All three are very different from one another in purpose and function, but they are all meant to work together in a single environment. Let's go over them: - eBook - ePub
HTML and CSS
The Comprehensive Guide
- Jürgen Wolf(Author)
- 2023(Publication Date)
- SAP PRESS(Publisher)
17 A Brief Introduction to JavaScript
JavaScript, Ajax, and jQuery are often mentioned in the same breath in the context of web development. For beginners, it’s often frustrating to be confronted with many different terms. In this chapter, you’ll first get to know some basics about JavaScript as a programming language.When it comes to web development, JavaScript has become indispensable. While you can use HTML to create the content of your website and CSS to design the layout and formatting, you’re still missing a way to dynamically influence the behavior of a website within the web browser. JavaScript enables you to perform Document Object Model (DOM) manipulations such as changing HTML elements, HTML attributes, and HTML styles, as well as checking entered data in HTML forms for correctness. Let’s not forget the now numerous JavaScript application programming interfaces (APIs; also called web APIs) in HTML. Even for the use of many frameworks, such as React, Angular, or Vue.js, you can’t get around sound JavaScript knowledge.This chapter is intended to give you a basic and simple introduction to the world of JavaScript. To avoid raising false hopes here, I should mention that this chapter will only introduce you to JavaScript as a scripting language. JavaScript is a programming language that can’t be described quickly in its entirety within one chapter. The introduction to JavaScript in this book only goes so far as to let you use JavaScript for client-side applications of the DOM, the interfaces between HTML, and dynamic JavaScript—more specifically—you’ll learn how to write programs that run in the web browser.Not only is JavaScript now suitable for client-side applications, as described in this book, but the language has become very versatile. For example, JavaScript is also used today for server-side applications, desktop applications, mobile applications, and even embedded applications. Even games and 3D applications can now be developed with JavaScript. However, this is only mentioned here in passing to show you that, with JavaScript, you learn a fairly ubiquitous language that can be used not only in the web browser. - No longer available |Learn more
Multimedia Web Design and Development
Using Languages to Build Dynamic Web Pages
- Theodor Richardson, Charles Thies(Authors)
- 2012(Publication Date)
- Mercury Learning and Information(Publisher)
client-side language, meaning all of the computations are done and actions are taken on the client’s Web browser.A programming language is a formal set of commands that can be used to manipulate data in a system; the programs using this kind of language are compiled and linked, turning the manually typed code into machine code prior to execution.A scripting language is a formal set of commands that can be used to manipulate data in a system; the scripts using this kind of language are written without the steps to compile and link them into machine code prior to execution.A client-side language, or front-end language, is a scripting or programming language that is executed on the local machine without involvement from the server. The client can view all source code.A server-side language , or back-end language, is a scripting or programming language that is executed on the server, where only the results of the computation are delivered to the client machine. In general, the client does not see the source code.Computational complexity is an estimate of how long it will take a program or a script to complete its operation. Syntax structures like loops and complex mathematics increase the complexity of a program or script. This can be measured in different units and is often a general estimate.A variable is a named placeholder representing a data value that may or may not change during execution.When JavaScript is invoked, the browser is using the computing resources of the local machine to process the information and compute the results. This means the server is not slowed down by this computation, but it also means the speed and efficiency of the script are determined by the state of the user’s machine, which is generally unknown. For this reason, JavaScript works best when it is concise and limited in computational complexity - eBook - ePub
JavaScript for Modern Web Development
Building a Web Application Using HTML, CSS, and JavaScript
- Alok Ranjan, Alok Ranjan, Abhilasha Sinha, Ranjit Battewad(Authors)
- 2020(Publication Date)
- BPB Publications(Publisher)
HAPTER 4JavaScript Programming: Making the Application Interactive
"Great web design without functionality is like a sports car with no engine." - Paul Cookson "Design is not just what it looks like and feels like. Design is how it works." - Steve JobsN ow that we know how to add and beautify web content using HTML and CSS, we next have to make this content live and interactive using JavaScript programming. JavaScript is the brain behind all the beauty of the web content. JavaScript defines how user interaction will be handled, what actions will happen, and what will be the next state of the application. In this chapter, you will be introduced to the basics of JavaScript, and you will get into the details of different aspects of JavaScript programming in the following few chapters.Structure
- Introduction to JavaScript
- Building blocks of JS
- More about functions
- Arrays
- Working with DOM
Objective
After studying this chapter, you will learn the basics of JavaScript and how to incorporate interactiveness and dynamic behavior to make your HTML pages smarter.Introduction to JavaScript (JS)
JavaScript (JS) is a light-weight, cross-platform, object-oriented computer programming language, which was developed to add logic and behavior to the web. In Chapter 1 , we saw a brief history of how JavaScript was born and how it continues to grow with every ECMAScript edition.Using JS, you can make your website dynamic and interactive. The power of JavaScript also lies in the fact that it can be used for both client-side and server-side programming as it can execute in the browser or on the server, or on any device that has a special program called the JavaScript engine. - eBook - PDF
Web Programming
Building Internet Applications
- Chris Bates(Author)
- 2014(Publication Date)
- Wiley(Publisher)
Java This is not a scripting language, 1 but it is used for many of the same things as JavaScript. It is very good at menus and data validation on the client but can be very slow. It is probably a better language for the development of proper networked applications than simple browser applets. In summary, if you want to embed some interactivity within a Web page then you can use any combination of a number of scripting languages and multimedia packages. If you want to make the basic HTML of your page both dynamic and interactive then you currently have no choice but to use JavaScript. 6.3 JavaScript – THE BASICS In many respects JavaScript code resembles C. I do not mean that programming in JavaScript is in any way like programming in C, but if you look at a page of code in each language then the two will look fairly similar. The semantics (i.e., the meaning of the code) of the 1 Although it is interpreted. Actually it is compiled and interpreted. 6.3. JavaScript – The Basics 145 two languages are very different but the syntax (i.e., the symbols and construction) of a JavaScript program and of a simple C program are quite close. The syntax of a language is the set of tokens that comprise it. Many languages borrow from the set of tokens used in C simply because most programmers can read C and hence most programmers can read code written in other languages. JavaScript can be run on some file and Web servers but the vast majority of users are developing front-ends for Web pages. That is the use that I am going to demonstrate. I am not going to explain the whole language in intricate detail. Plenty of books and on-line resources are available which will do that. A list of keywords does not really help you to learn the language – a basic explanation of how it all works and some simple examples is a much more useful educational tool. 6.3.1 A Simple Script The script that follows could hardly be easier. It is almost the JavaScript version of ‘‘Hello World!’’. - eBook - PDF
- Chris Minnick(Author)
- 2022(Publication Date)
- For Dummies(Publisher)
What Is JavaScript? CHAPTER 1 What Is JavaScript? 167 » Tabs within web pages » Sortable lists » Magic Zoom (see Figure 1-4) Why JavaScript? JavaScript has become the standard for creating dynamic user interfaces for the web. Pretty much any time you visit a web page with animation, live data, a but- ton that changes when you hover over it, or a drop-down menu, JavaScript is at work. Because of its power and ability to run in any web browser, JavaScript cod- ing is the most popular and necessary skill for a modern web developer to have. FIGURE 1-4: So-called Magic Zoom effects are enabled using JavaScript. © John Wiley & Sons 168 BOOK 3 Advanced Web Coding JavaScript is easy to learn! Keep in mind that programming languages were created to give people a simple way to talk to computers and tell them what to do. Compared with machine language, the language that the computer’s CPU speaks, every programming language is easy and understandable. To give you a sample of what sort of instructions your computer is actually obeying, here is a machine language pro- gram to write out "Hello World". b8 21 0a 00 00 a3 0c 10 00 06 b8 6f 72 6c 64 a3 08 10 00 06 b8 6f 2c 20 57 a3 04 10 00 06 b8 48 65 6c a3 00 10 00 06 b9 00 10 00 06 ba 10 00 00 00 bb 01 00 00 00 b8 04 00 00 00 cd 80 b8 01 00 00 00 cd 80 Now look at one way you can accomplish this simple task with JavaScript: alert("Hello World"); Much easier, yes? Once you learn the basic rules of the road (called the syntax), such as when to use parentheses and when to use curly brackets ({}), JavaScript resembles plain old English. The first step in learning any language, including programming languages, is to get over your fear of getting started. JavaScript makes this easy. There are thou- sands of sample bits of JavaScript code on the web that anyone can just pick up and start messing around with. - eBook - ePub
- Darren Jones(Author)
- 2017(Publication Date)
- SitePoint(Publisher)
JavaScript is a high-level scripting language that is interpreted and compiled at run time. This means it requires an engine that's responsible for interpreting a program and running it. The most common JavaScript engines are found in browsers such as Firefox, Chrome or Safari, although JavaScript can be run without a browser using an engine such as Google V8. Many modern JavaScript engines use a Just-In-Time (JIT) interpreting process, which considerably speeds up the compilation, making programs run faster.JavaScript is also a dynamic language, so elements of a program can change while it's running, and it can do lots of things in the background at run time (such as type checking, which we'll cover later) ― things that a compiled language like C++ would do at compile time.The History of JavaScript
The World Wide Web started life as a bunch of pages linked by hyperlinks. Users soon wanted more interaction with these pages, so Netscape (an early browser vendor) asked one of their employees, Brendan Eich, to develop a new language for their Navigator browser. This needed to be done quickly because of the intense competition between Netscape and Microsoft at the time.Eich managed to create a prototype scripting language in just 10 days. To do this, he borrowed various elements from other languages, including AWK, Java, Perl, Scheme, HyperTalk and Self. This was an impressive feat, but in the rush to be first to market, a number of quirks and bugs ended up in the language that were never fully addressed.The new language was originally called Mocha, but it was changed to LiveScript, then hastily rebranded as JavaScript so it could benefit from the publicity that Sun Microsystem’s Java language was attracting at the time. This name has often caused some confusion, with JavaScript often considered a lighter version of Java. However, the two languages are unrelated ― though JavaScript does have syntactical similarities to Java.JavaScript made its debut in version 2 of Netscape’s Navigator browser in 1995. The following year, Microsoft reverse-engineered JavaScript to create their own version, calling it JScript to avoid copyright issues with Sun Microsystems, who owned the Java trademark. JScript shipped with version 3 of the Internet Explorer browser, and was almost identical to JavaScript ― it even included all the same bugs and quirks ― but it did have some extra Internet Explorer-only features. Microsoft included another scripting language called VBScript with Internet Explorer at the same time. - eBook - PDF
- Rob Larsen(Author)
- 2013(Publication Date)
- Wrox(Publisher)
10 340 ❘ CHAPTER 10 LEARNING JavaScript JavaScript gives web developers a programming language to use in web pages that enables them to perform tasks such as the following: ‰ ‰ Read elements from documents and write new elements and text into documents. ‰ ‰ Manipulate or move text. ‰ ‰ Perform mathematical calculations on data. ‰ ‰ React to events, such as a user clicking a button. ‰ ‰ Retrieve the current date and time from a user’s computer or the last time a document was modified. ‰ ‰ Determine the user’s screen size, browser version, or screen resolution. ‰ ‰ Perform actions based on conditions such as alerting users if they enter the wrong informa- tion into a form. You might need to read through this chapter more than once to get a good grasp of what you can do with JavaScript. Then, after you see the examples in the next three chapters, you should have a better idea of its power. There is a lot to learn, but these three chapters should get you well on your way. WARNING JavaScript is not the same as Java, which is a different programming language. WHAT IS PROGRAMMING ABOUT? As you see in this chapter, programming is largely about performing different types of calculations upon various types of data (including numbers, text, and graphics). In all programming languages you can perform tasks such as ‰ ‰ Performing mathematical calculations on numbers such as addition, subtraction, multiplica- tion, and division. ‰ ‰ Working with text to find out how long a sentence is, or where the first occurrence of a specified letter is within a section of text. ‰ ‰ Checking if one value (a number or letter) matches another. ‰ ‰ Checking if one value is shorter or longer, lower or higher than another. ‰ ‰ Performing different actions based on whether a condition (or one of several conditions) is met. For example, if a user enters a number less than 10, a script or program can perform one action; otherwise it performs a different action. - Available until 4 Dec |Learn more
- Ray Toal, Rachel Rivera, Alexander Schneider, Eileen Choe(Authors)
- 2016(Publication Date)
- Chapman and Hall/CRC(Publisher)
C H A P T E R 1 JavaScript We’ll begin our tour with JavaScript, because it is, by some measures, the most popular programming language in the world. First appeared 1995 Creator Brendan Eich Notable versions ES3 (1999) • ES5 (2009) • ES2015 (2015) Recognized for First-class functions, Weak typing, Prototypes Notable uses Web application clients, Asynchronous servers Tags Imperative, Functional, Dynamic, Prototypal Six words or less “The assembly language of the web” JavaScript was designed and implemented in ten days in 1995 by Brendan Eich, then at Netscape Communications Corporation, with the goal of creating an amateur-friendly scripting language embedded into a web browser. The syntax of the language was strongly influenced by C, with curly braces, assignment statements, and the ubiquitous if, while, and for statements. Semantically, however, JavaScript and C are worlds apart. JavaScript’s influence here was the lesser-known language Scheme. Functions are first-class values: they can be assigned to variables, passed to functions, and returned from functions. The goal of allowing novice programmers to write small scripts in web page markup led to some well-loved design choices, including array (e.g., [10, 20, 30]) and object (e.g., {x:3, y:5}) literals. Yet the attempt to keep the language simple led to several notorious features as well. Weak typing, where expressions of the wrong type are automatically coerced to “something that works,” and automatic semicolon insertion, where the lan- guage will figure out where your statements begin and end when you are not explicit, save typing but sometimes produce utterly surprising behavior. Douglas Crockford [20] has cat- alogued these and a number of other “Bad Parts” and “Awful Parts,” while at the same time praising JavaScript as “[having] some extraordinarily good parts.
Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.









