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

6 Key excerpts on "JavaScript"

  • The JavaScript Workshop
    eBook - ePub

    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:
  • HTML and CSS
    eBook - ePub

    HTML and CSS

    The Comprehensive Guide

    • Jürgen Wolf(Author)
    • 2023(Publication Date)
    • SAP PRESS
      (Publisher)
    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.
    For the professional handling of JavaScript I recommend you read JavaScript (SAP PRESS, 2022) by Philip Ackermann, who was also an expert reviewer for this book.

    17.1    JavaScript in Web Development

    The JavaScript language has been around since 1995 and has been constantly evolving ever since. In the beginning, language was seen more as a toy that could be used for all kinds of mischief. JavaScript only really got going as years passed. With Ajax, the language experienced a real boom, and there were first meaningful applications that would have been impossible without JavaScript on the client side.
    JavaScript is a genuine and ubiquitous programming language, and if you’ve never programmed in another language such as PHP, Java, or C++ before, this is probably your first real programming language that you’ll learn here. If you already have experience in another programming language, this chapter will be easy for you.
    JavaScript Is an Interpreted Programming Language
    JavaScript is an interpreted programming language where the source code is executed by an interpreter on the computer. The interpreter, in turn, converts the source code into machine code, statement by statement. Usually, you don’t have to worry about anything. You can write the source code with any text editor, and the interpreter is provided and executed in the web browser.
    The counterpart to an interpreted programming language is the compiled programming language. Here, the source code is translated into machine code by a compiler. You can then run the programs created in this way on the operating system for which you compiled it, without any further tools (e.g., an interpreter). Examples of a compiled language include C, C++, or Swift.
  • JavaScript Bible
    eBook - ePub
    • Danny Goodman, Michael Morrison, Paul Novitski, Tia Gustaff Rayl(Authors)
    • 2010(Publication Date)
    • Wiley
      (Publisher)
    Part I Getting Started with JavaScript In This Part
    Chapter 1 JavaScript's Role in the World Wide Web and Beyond
    Chapter 2 Developing a Scripting Strategy
    Chapter 3 Selecting and Using Your Tools
    Chapter 4 JavaScript Essentials
    Passage contains an image 1 JavaScript's Role in the World Wide Web and Beyond In This Chapter
    How JavaScript blends with other web-authoring technologies The history of JavaScript What kinds of jobs you should and should not entrust to JavaScript
    Many of the technologies that make the World Wide Web possible have far exceeded their original goals. Envisioned at the outset as a medium for publishing static text and image content across a network, the Web is forever being probed, pushed, and pulled by content authors. By taking for granted so much of the “dirty work” of conveying the bits between server and client computers, content developers and programmers dream of exploiting that connection to generate new user experiences and practical applications. It's not uncommon for a developer community to take ownership of a technology and mold it to do new and exciting things. But with so many web technologies—especially browser programming with JavaScript—within reach of everyday folks, we have witnessed an unprecedented explosion in turning the World Wide Web from a bland publishing medium into a highly interactive, operating system–agnostic authoring platform.
    The JavaScript language, working in tandem with related browser features, is a web-enhancing technology. When employed on the client computer, the language can help turn a static page of content into an engaging, interactive, and intelligent experience. Applications can be as subtle as welcoming a site's visitor with the greeting “Good morning!” when it is morning in the client computer's time zone—even though it is dinnertime where the server is located. Or, applications can be much more obvious, such as delivering the content of a slide show in a one-page download while JavaScript controls the sequence of hiding, showing, and “flying slide” transitions as we navigate through the presentation.
  • Building Websites All-in-One For Dummies
    • Doug Sahlin(Author)
    • 2012(Publication Date)
    • For Dummies
      (Publisher)
    Any script that reacts to a user, but does not send a record of that activity to a server, is a client-side script. And JavaScript is where almost all of them come from.
    Seeing How JavaScript Works
    Scripts and programs are very different if you go see a play. The script tells the actors what to say, and the program tells you how many acts are in the play and who the actors are. But in web design, a script and a program are the same thing. Scripts and programs (in web design) are batches of computer code that make something happen. That something might be a program that reacts to a user’s click, or a program that updates the weather in a website.
    Websites that are interactive (react to visitors’ actions) or animated (have things that move around), or both, are created using a scripting/programming language.
    JavaScript is a scripting language and a programming language because it’s used to write programs that make things happen.
    So, then, what is not a scripting or programming language? Neither HTML nor CSS are scripting/programming languages. HTML is considered a “markup” language because it is used to define content (like a heading, or a form), but it doesn’t (“in the main”) do anything. CSS is considered a styling language because, in the main, it defines how web page elements look.
    Take a look, in very broad strokes, at the “how” of JavaScript. In very basic terms, it might be helpful to think of two levels of JavaScript:
  • Beginning HTML and CSS
    • Rob Larsen(Author)
    • 2013(Publication Date)
    • Wrox
      (Publisher)
    Although you can’t learn everything there is to learn about jQuery and JavaScript in this book, many free jQuery resources are on the web that you can use today to enhance your pages. Therefore, the aim of this chapter is to teach you enough to start using these scripts in your web pages and to understand how they work. You can customize these scripts and write some basic scripts of your own based upon what you learn in this chapter. In addition, this is a good introduction to general programming concepts.
    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 information 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.
    start feature
    WARNING JavaScript is not the same as Java, which is a different programming language.
    end feature

    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
  • Programming Language Explorations
    • Ray Toal, Rachel Rivera, Alexander Schneider, Eileen Choe(Authors)
    • 2016(Publication Date)
    CHAPTER 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 language 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 catalogued these and a number of other “Bad Parts” and “Awful Parts,” while at the same time praising JavaScript as “[having] some extraordinarily good parts. In JavaScript there is a beautiful, elegant, highly expressive language that is buried under a steaming pile of good intentions and blunders.” [20 , p. 2
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.