From 0fac72a5a8b1cb9578b4af4fae786f1f8c6e3443 Mon Sep 17 00:00:00 2001 From: Andrea Bianchi Date: Mon, 10 Mar 2025 09:21:11 +0900 Subject: [PATCH] w3.1 added --- .gitignore | 2 +- w3_1_arrays/arrays.js | 4 ++++ w3_1_arrays/index.html | 16 ++++++++++++++ w3_1_arrays/objects.js | 48 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 w3_1_arrays/arrays.js create mode 100644 w3_1_arrays/index.html create mode 100644 w3_1_arrays/objects.js diff --git a/.gitignore b/.gitignore index f7013fc..3aecd78 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,5 @@ node_modules/** .git/** .DS_Store todo -*/*_solution +*/*_solution.* TODO/** \ No newline at end of file diff --git a/w3_1_arrays/arrays.js b/w3_1_arrays/arrays.js new file mode 100644 index 0000000..2ca18ab --- /dev/null +++ b/w3_1_arrays/arrays.js @@ -0,0 +1,4 @@ +const paragraph = `Call me Ishmael. Some years ago- never mind how long precisely- having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation. Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and especially whenever my hypos get such an upper hand of me, that it requires a strong moral principle to prevent me from deliberately stepping into the street, and methodically knocking people's hats off- then, I account it high time to get to sea as soon as I can. This is my substitute for pistol and ball. With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship. There is nothing surprising in this. If they but knew it, almost all men in their degree, some time or other, cherish very nearly the same feelings towards the ocean with me.`; + +// Print a frequency counter of all the letters of the alphabet appearing in the paragraph +// Ignore case diff --git a/w3_1_arrays/index.html b/w3_1_arrays/index.html new file mode 100644 index 0000000..0cce74a --- /dev/null +++ b/w3_1_arrays/index.html @@ -0,0 +1,16 @@ + + + + + + + + Types + + + + + + + + diff --git a/w3_1_arrays/objects.js b/w3_1_arrays/objects.js new file mode 100644 index 0000000..2b638ab --- /dev/null +++ b/w3_1_arrays/objects.js @@ -0,0 +1,48 @@ +/** + * typedef {{name:string, age:number, job:string}} Person + * + */ +const persons = [ + { name: "John", age: 30, job: "Developer" }, + { name: "Mary", age: 25, job: "Designer" }, + { name: "Peter", age: 27, job: "Developer" }, + { name: "Jane", age: 22, job: "Designer" }, + { name: "Bob", age: 33, job: "Developer" }, + { name: "Alice", age: 35, job: "Manager" }, + { name: "Tim", age: 32, job: "Designer" }, + { name: "Sara", age: 21, job: "Designer" }, + { name: "Tom", age: 34, job: "Developer" }, + { name: "Alex", age: 24, job: "Manager" }, + { name: "John", age: 30, job: "Manager" }, + { name: "Mary", age: 25, job: "Designer" }, + { name: "Peter", age: 27, job: "Developer" }, + { name: "Jane", age: 22, job: "Designer" }, + { name: "Bob", age: 33, job: "Developer" }, + { name: "Alice", age: 35, job: "Manager" }, + { name: "Tim", age: 32, job: "Designer" }, + { name: "Sara", age: 21, job: "Designer" }, + { name: "Tom", age: 34, job: "Developer" }, + { name: "Alex", age: 24, job: "Developer" }, +]; + +/** + * averageAge. + * + * @param {Person[]} persons + */ +function averageAge(persons) { + // placehlder +} + +console.log(averageAge(persons)); + +/** + * listJobs. + * + * @param {Person[]} persons + */ +function listJobs(persons) { + // placehlder +} + +console.log(listJobs(persons));