diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7251ace --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +node_modules +**/.DS_Store +todo/** +_*.js diff --git a/README.md b/README.md index e69de29..8de45d4 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,3 @@ +# Exercises + +Repository with exercises for [ID499 - Software Prototyping](https://software.prototyping.id). diff --git a/w2_1_types/README.md b/w2_1_types/README.md new file mode 100644 index 0000000..efb3daf --- /dev/null +++ b/w2_1_types/README.md @@ -0,0 +1,5 @@ +# Week 1 - Types + +How to open the devtools + + diff --git a/w2_1_types/assets/devtools.png b/w2_1_types/assets/devtools.png new file mode 100644 index 0000000..355bc50 Binary files /dev/null and b/w2_1_types/assets/devtools.png differ diff --git a/w2_1_types/index.html b/w2_1_types/index.html new file mode 100644 index 0000000..51140ec --- /dev/null +++ b/w2_1_types/index.html @@ -0,0 +1,16 @@ + + + +
+ + + +
+
+
+
+
\ No newline at end of file
diff --git a/w2_1_types/main.js b/w2_1_types/main.js
new file mode 100644
index 0000000..2cd0141
--- /dev/null
+++ b/w2_1_types/main.js
@@ -0,0 +1,41 @@
+// Types and conversions
+
+// Ex 1 (implicit convertion)
+// Compute the time in seconds
+function timeInSeconds(hours, mins, secs) {
+ // placeholder
+ // return (hours * 60 + mins) * 60 + secs;
+}
+
+console.log('Ex 1');
+console.log('timeInSeconds(0, 0, 12) is... ', timeInSeconds(0, 0, 12));
+console.log('timeInSeconds(0, 1, 12) is... ', timeInSeconds(0, 1, 12));
+console.log('timeInSeconds(2, 1, "AB") is... ', timeInSeconds(2, 1, 'AB'));
+
+// Ex 2 (string templates)
+// Print a student record
+/*
+{
+ name: 'Andrea',
+ id: 20200212
+}
+*/
+function print(student) {
+ // placeholder
+}
+
+// console.log('Ex 2');
+// print({ name: 'Andrea', id: 20200212 });
+// print({ id: 20200212 });
+// print(undefined);
+
+// Ex 3 (type casting)
+// Given a csv string like "andrea,20200212", create an object like the one in Ex 2
+function csvToObj(csv) {
+ // placeholder
+}
+
+// console.log('Ex 3');
+// print(csvToObj('andrea,20200212'));
+// print(csvToObj('andrea'));
+// print(csvToObj(undefined));