mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 18:05:07 +00:00
Base: Move "js" and "little" HackStudio projects into ~/Source/
This commit is contained in:
parent
bc615572a9
commit
db450dbc44
28 changed files with 1 additions and 1 deletions
11
Base/home/anon/Source/js/array.js
Normal file
11
Base/home/anon/Source/js/array.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
var a = [1, 2, 3];
|
||||
|
||||
a[1] = 5;
|
||||
|
||||
var push_result = a.push(7);
|
||||
|
||||
for (var i = 0; i < a.length; ++i) {
|
||||
console.log(a[i]);
|
||||
}
|
||||
|
||||
console.log("push result: " + push_result);
|
2
Base/home/anon/Source/js/charAt.js
Normal file
2
Base/home/anon/Source/js/charAt.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
var foo = "foobar";
|
||||
console.log(foo.charAt(3));
|
5
Base/home/anon/Source/js/console.js
Normal file
5
Base/home/anon/Source/js/console.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
console.log("I am a generic log message");
|
||||
console.debug("I am a debug log message");
|
||||
console.info("I am an info log message");
|
||||
console.warn("I am a warning log message");
|
||||
console.error("I am an error log message");
|
14
Base/home/anon/Source/js/date.js
Normal file
14
Base/home/anon/Source/js/date.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
var now = Date.now();
|
||||
console.log("Unix timestamp: " + now / 1000);
|
||||
|
||||
var d = new Date();
|
||||
var year = d.getFullYear();
|
||||
var month = (d.getMonth() + 1).toString().padStart(2, "0");
|
||||
var day = d.getDate().toString().padStart(2, "0");
|
||||
var hours = d.getHours().toString().padStart(2, "0");
|
||||
var minutes = d.getMinutes().toString().padStart(2, "0");
|
||||
var seconds = d.getSeconds().toString().padStart(2, "0");
|
||||
var milliseconds = d.getMilliseconds().toString().padStart(3, "0");
|
||||
|
||||
console.log("Date: " + year + "-" + month + "-" + day);
|
||||
console.log("Time: " + hours + ":" + minutes + ":" + seconds + "." + milliseconds);
|
5
Base/home/anon/Source/js/for-loop.js
Normal file
5
Base/home/anon/Source/js/for-loop.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
var x = 0;
|
||||
for (var i = 0; i !== 3; i += 1) {
|
||||
x += 2;
|
||||
}
|
||||
x;
|
5
Base/home/anon/Source/js/forced-gc.js
Normal file
5
Base/home/anon/Source/js/forced-gc.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
function foo() {
|
||||
var x = {};
|
||||
gc();
|
||||
}
|
||||
foo();
|
4
Base/home/anon/Source/js/function-with-arguments.js
Normal file
4
Base/home/anon/Source/js/function-with-arguments.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
function foo(a, b) {
|
||||
return a + b;
|
||||
}
|
||||
foo(1, 2 + 3);
|
8
Base/home/anon/Source/js/gc-strings.js
Normal file
8
Base/home/anon/Source/js/gc-strings.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
function foo() {
|
||||
var a = [];
|
||||
for (var i = 0; i < 4000; ++i) {
|
||||
a.push("string" + i);
|
||||
}
|
||||
}
|
||||
|
||||
foo();
|
2
Base/home/anon/Source/js/hasOwnProperty.js
Normal file
2
Base/home/anon/Source/js/hasOwnProperty.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
var x = "foobar";
|
||||
console.log(x.hasOwnProperty("length"));
|
2
Base/home/anon/Source/js/javascript.hackstudio
Normal file
2
Base/home/anon/Source/js/javascript.hackstudio
Normal file
|
@ -0,0 +1,2 @@
|
|||
javascript.hackstudio
|
||||
*.js
|
1
Base/home/anon/Source/js/native-function.js
Normal file
1
Base/home/anon/Source/js/native-function.js
Normal file
|
@ -0,0 +1 @@
|
|||
console.log("Hello friends!")
|
10
Base/home/anon/Source/js/object-expression.js
Normal file
10
Base/home/anon/Source/js/object-expression.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
const a = 1;
|
||||
const computedKey = "d";
|
||||
const object = {a, b: 2, "c": 3, [computedKey]: 2 + 2};
|
||||
const emptyObject = {};
|
||||
|
||||
console.log(object.a);
|
||||
console.log(object.b);
|
||||
console.log(object.c);
|
||||
console.log(object.d);
|
||||
console.log(emptyObject.foo);
|
2
Base/home/anon/Source/js/operator-precedence.js
Normal file
2
Base/home/anon/Source/js/operator-precedence.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
var foo = 1 + 2 * 3 - 4 / 5;
|
||||
foo.bar();
|
2
Base/home/anon/Source/js/simple-function.js
Normal file
2
Base/home/anon/Source/js/simple-function.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
function foo() { return (1 + 2) + 3; }
|
||||
foo();
|
7
Base/home/anon/Source/js/simple-parse.js
Normal file
7
Base/home/anon/Source/js/simple-parse.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
var foo = 1;
|
||||
function bar() {
|
||||
return 38;
|
||||
}
|
||||
foo = {};
|
||||
foo = bar() + 4;
|
||||
foo;
|
11
Base/home/anon/Source/js/simple-scopes.js
Normal file
11
Base/home/anon/Source/js/simple-scopes.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
//I should return `undefined` because y is bound to the inner-most enclosing function, i.e the nested one (bar()), therefore, it's undefined in the scope of foo()
|
||||
function foo() {
|
||||
function bar() {
|
||||
var y = 6;
|
||||
}
|
||||
|
||||
bar();
|
||||
return y;
|
||||
}
|
||||
|
||||
console.log(foo());
|
7
Base/home/anon/Source/js/simple-variables.js
Normal file
7
Base/home/anon/Source/js/simple-variables.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
c = 1;
|
||||
function foo() {
|
||||
var a = 5;
|
||||
var b = 7;
|
||||
return a + b + c;
|
||||
}
|
||||
foo();
|
1
Base/home/anon/Source/js/string-length.js
Normal file
1
Base/home/anon/Source/js/string-length.js
Normal file
|
@ -0,0 +1 @@
|
|||
"hello friends".length
|
12
Base/home/anon/Source/js/strings.js
Normal file
12
Base/home/anon/Source/js/strings.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
var d = "Double quoted string\n";
|
||||
console.log(d);
|
||||
var s = 'Single quoted string\n';
|
||||
console.log(s)
|
||||
var e = "Escaped characters \b \f \n \r \t \v \' \" \\ \n";
|
||||
console.log(e)
|
||||
var u = "Unterminated string
|
||||
this is not possible in js\n";
|
||||
console.log(u);
|
||||
|
||||
var u2 = 'This is neither\n
|
||||
console.log(u2);
|
5
Base/home/anon/Source/js/throw.js
Normal file
5
Base/home/anon/Source/js/throw.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
try {
|
||||
throw 123;
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
10
Base/home/anon/Source/js/try.js
Normal file
10
Base/home/anon/Source/js/try.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
try {
|
||||
console.log("you should see me");
|
||||
foo();
|
||||
console.log("not me");
|
||||
} catch (e) {
|
||||
console.log("catch");
|
||||
console.log(e.name);
|
||||
} finally {
|
||||
console.log("finally");
|
||||
}
|
12
Base/home/anon/Source/js/type-play.js
Normal file
12
Base/home/anon/Source/js/type-play.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
const object = {};
|
||||
|
||||
console.log(true == 1);
|
||||
console.log(null == undefined);
|
||||
console.log("12" == 12);
|
||||
console.log(1 + "12");
|
||||
console.log(12 / "12" == true);
|
||||
console.log(2 * "12");
|
||||
console.log(~"24");
|
||||
console.log(~true);
|
||||
console.log(2*2 + "4");
|
||||
console.log(object == "[object Object]");
|
1
Base/home/anon/Source/js/typeof.js
Normal file
1
Base/home/anon/Source/js/typeof.js
Normal file
|
@ -0,0 +1 @@
|
|||
console.log(typeof undefined, typeof true, typeof 'a', typeof 1, typeof {});
|
Loading…
Add table
Add a link
Reference in a new issue