Introduction to Javascript

Cards (76)

  • In JavaScript, to declare a new variable, we can use the keywords: var, let, and const
  • Variable names are used to identify and store data in JavaScript
  • There are different data types in JavaScript that include primitive data types
  • JavaScript is a front-end scripting language developed by Netscape for dynamic content
  • JavaScript is lightweight, but with limited capabilities
  • JavaScript can be used as an object-oriented language
  • JavaScript is a client-side technology
  • JavaScript is embedded in your HTML page and interpreted by the Web browser
  • Client-side JavaScript is the language's most common format
  • Client-side JavaScript implies that HTML can incorporate client-interacting programs, control the browser, and make the content of the HTML powerful
  • JavaScript was initially named "LiveScript" and later changed to "JavaScript" to position it as the "younger brother" of Java
  • JavaScript was submitted for standardization to the ECMA world organization
  • The standardized language is known as ECMAScript
  • JavaScript is supported by major browsers like Firefox, Chrome, Internet Explorer, Safari, and Opera
  • Advantages of JavaScript:
  • Less contact with the server allows for validating user feedback before sending the page to the server
  • Immediate feedback to visitors without the need for page reloads
  • Expanded interactivity for creating responsive web page interfaces
  • Greater interfacing capabilities for richer GUI on web pages
  • Limitations of JavaScript:
  • JavaScript cannot read or write files
  • JavaScript lacks support for organizing applications
  • JavaScript runs in a single execution thread
  • How to use JavaScript in your web page:
  • JavaScript codes run from inside a web page using the <script> element
  • Scripts can be embedded or placed in an external file and connected to a page like CSS
  • External <script> elements use the src attribute to point to a script file with a .js suffix
  • Benefits of using external style sheets for JavaScript:
  • Allows the application of the same script to different websites
  • Each external script requires an additional server HTTP request, which can slow down performance
  • Variables in JavaScript are also known as holders or containers
  • Variables allow you to position data and refer to the data by naming the container
  • Variables can be known as something that may change
  • In JavaScript, variables can hold various data values
  • To declare a new variable in JavaScript, keywords var, let, and const are used
  • Using var keyword
  • var keyword is used to create and declare a variable
  • Variables can be declared without initializing or initialized with a number using var
  • Using let
  • let variables are declared similarly to var but impose scope constraints