跳至內容

JavaScript

kemasi Wikipedia
aicu a sinivecikan a JavaScript i tua tingnaw.

namasanpazangal a matjaita a kavecikan nua i tingnaw avan aicu a JavaScript (djavaskript a tja siaya; sinipapukeljang tua lingav nua tja supuin aza takalan avan a /ˈdʒɑːvəskrɪpt/). a tja kineljangan uta a JS taza kavecikan. a tja mapacunan tua pakaljingasan a World Wide Web, HTML katua CSS, izua liaw a sinivecikan a JavaScript.[1] na sinansapitj aicu a kavecikan a JavaScript tua tjaliaw tua 97% a sapitj a pakatua ljingas.[2]

katjaisangas amin izua sivecivecik a JavaScript nua rusanremasudj tua sisupuan tua sapitj nua i ljingas sakamaya, izua uta zuma a sirasurasudj i tua tingnaw a pasuvililj.

setadjalan aicu a ngadan katua sipatjekaiyan nua JavaScript katua Java sakamaya, maretimalji aza matjadrusa a sikakaiyan nu venecik.

// Declares a function-scoped variable named `x`, and implicitly assigns the
// special value `undefined` to it. Variables without value are automatically
// set to undefined.
var x;

// Variables can be manually set to `undefined` like so
var x2 = undefined;

// Declares a block-scoped variable named `y`, and implicitly sets it to
// `undefined`. The `let` keyword was introduced in ECMAScript 2015.
let y;

// Declares a block-scoped, un-reassignable variable named `z`, and sets it to
// a string literal. The `const` keyword was also introduced in ECMAScript 2015,
// and must be explicitly assigned to.

// The keyword `const` means constant, hence the variable cannot be reassigned
// as the value is `constant`.
const z = "this value cannot be reassigned!";

// Declares a global-scoped variable and assigns 3.  This is generally considered
// bad practice, and will not work if strict mode is on.
t = 3;

// Declares a variable named `myNumber`, and assigns a number literal (the value
// `2`) to it.
let myNumber = 2;

// Reassigns `myNumber`, setting it to a string literal (the value `"foo"`).
// JavaScript is a dynamically-typed language, so this is legal.
myNumber = "foo";
  1. Flanagan, David (18 April 2011). JavaScript: the definitive guide. Beijing; Farnham: O'Reilly. p. 1. ISBN 978-1-4493-9385-4. OCLC 686709345. "JavaScript is part of the triad of technologies that all Web developers must learn: HTML to specify the content of web pages, CSS to specify the presentation of web pages, and JavaScript to specify the behavior of web pages."
  2. "Usage statistics of JavaScript as client-side programming language on websites". w3techs.com. 2021-04-09. Archived from the original on 2022-02-13. Retrieved 2021-04-09.