Skip to content

Commit

Permalink
More fixes to Expected output comments in JS examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
atg committed Dec 14, 2024
1 parent 8005ce5 commit 7165c76
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 21 deletions.
1 change: 1 addition & 0 deletions live-examples/js-examples/classes/classes-static.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class ClassWithStaticMethod {
console.log('Class static initialization block called');
}
}
// Expected output: "Class static initialization block called"

console.log(ClassWithStaticMethod.staticProperty);
// Expected output: "someValue"
Expand Down
8 changes: 4 additions & 4 deletions live-examples/js-examples/json/json-stringify.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
console.log(JSON.stringify({ x: 5, y: 6 }));
// Expected output: '{"x":5,"y":6}'
// Expected output: "{"x":5,"y":6}"

console.log(
JSON.stringify([new Number(3), new String('false'), new Boolean(false)]),
);
// Expected output: '[3,"false",false]'
// Expected output: "[3,"false",false]"

console.log(JSON.stringify({ x: [10, undefined, function () {}, Symbol('')] }));
// Expected output: '{"x":[10,null,null,null]}'
// Expected output: "{"x":[10,null,null,null]}"

console.log(JSON.stringify(new Date(2006, 0, 2, 15, 4, 5)));
// Expected output: '"2006-01-02T15:04:05.000Z"'
// Expected output: ""2006-01-02T15:04:05.000Z""
2 changes: 1 addition & 1 deletion live-examples/js-examples/number/number-tolocalestring.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ console.log(eArabic('123456.789'));
// Expected output: "123456.789"

console.log(eArabic(NaN));
// Expected output: "ليس رقم"
// Expected output: "ليس رقم"
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ const proxy1 = new Proxy(monster1, handler1);

for (const key of Object.keys(proxy1)) {
console.log(key);
// Expected output: "_age"
// Expected output: "eyeCount"
}
// Expected output: "_age"
// Expected output: "eyeCount"
4 changes: 2 additions & 2 deletions live-examples/js-examples/set/set-prototype-add.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ set1.add(13);

for (const item of set1) {
console.log(item);
// Expected output: 42
// Expected output: 13
}
// Expected output: 42
// Expected output: 13
4 changes: 2 additions & 2 deletions live-examples/js-examples/set/set-prototype-entries.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ const iterator1 = set1.entries();

for (const entry of iterator1) {
console.log(entry);
// Expected output: Array [42, 42]
// Expected output: Array ["forty two", "forty two"]
}
// Expected output: Array [42, 42]
// Expected output: Array ["forty two", "forty two"]
2 changes: 1 addition & 1 deletion live-examples/js-examples/string/string-fromcodepoint.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
console.log(String.fromCodePoint(9731, 9733, 9842, 0x2f804));
// Expected output: "☃★♲"
// Expected output: "☃★♲你"
2 changes: 1 addition & 1 deletion live-examples/js-examples/string/string-lastindexof.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ const paragraph = "I think Ruth's dog is cuter than your dog!";
const searchTerm = 'dog';

console.log(
`Index of the last ${searchTerm} is ${paragraph.lastIndexOf(searchTerm)}`,
`Index of the last "${searchTerm}" is ${paragraph.lastIndexOf(searchTerm)}`,
);
// Expected output: "Index of the last "dog" is 38"
4 changes: 2 additions & 2 deletions live-examples/js-examples/string/string-tolocalelowercase.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const dotted = 'İstanbul';

console.log(`EN-US: ${dotted.toLocaleLowerCase('en-US')}`);
// Expected output: "i̇stanbul"
// Expected output: "EN-US: i̇stanbul"

console.log(`TR: ${dotted.toLocaleLowerCase('tr')}`);
// Expected output: "istanbul"
// Expected output: "TR: istanbul"
4 changes: 2 additions & 2 deletions live-examples/js-examples/string/string-trimend.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const greeting = ' Hello world! ';

console.log(greeting);
// Expected output: " Hello world! ";
// Expected output: " Hello world! "

console.log(greeting.trimEnd());
// Expected output: " Hello world!";
// Expected output: " Hello world!"
4 changes: 2 additions & 2 deletions live-examples/js-examples/string/string-trimstart.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const greeting = ' Hello world! ';

console.log(greeting);
// Expected output: " Hello world! ";
// Expected output: " Hello world! "

console.log(greeting.trimStart());
// Expected output: "Hello world! ";
// Expected output: "Hello world! "
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ console.log(Symbol('desc').toString());
// Expected output: "Symbol(desc)"

console.log(Symbol.iterator.toString());
// Expected output: "Symbol(Symbol.iterator)
// Expected output: "Symbol(Symbol.iterator)"

console.log(Symbol.for('foo').toString());
// Expected output: "Symbol(foo)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ function isNegative(element /*, index, array */) {

const int8 = new Int8Array([10, 0, -10, 20, -30, 40, 50]);

console.log(int8.find(isNegative));
console.log(int8.findLast(isNegative));
// Expected output: -30

0 comments on commit 7165c76

Please sign in to comment.