diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.js')
-rw-r--r-- | testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.js b/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.js new file mode 100644 index 0000000000..b75d40dcde --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.js @@ -0,0 +1,31 @@ +// Taken from https://en.wikipedia.org/wiki/JavaScript + +// 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 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"; + +const target = "foo"; |