test homework week1 - #14
Conversation
| 5. Write a program that checks the types of two variables and prints out `SAME TYPE` if they are the same type. | ||
| For example: | ||
| 1.1 First, _declare_ your variable `x`. | ||
| 1.2 Add a console.log statement that explains what _you think_the value of `x` is, like in this example: |
There was a problem hiding this comment.
...that explains in words...
There was a problem hiding this comment.
yes that is a better way of putting it!
| 3.4 Console.log `z` again. | ||
|
|
||
| 4. Arrays! | ||
| 4.1 Declare an empty array (you can decide on how to call it yourself). |
There was a problem hiding this comment.
I would like to hammer in early that choosing appropriate names is paramount in programming. So I would propose to add this sentence: `(you can decide on how to call it yourself, but read on a bit here and see if you can find a good name that exactly describes what this variable will hold).
| 4.3 Console.log your array. | ||
| 4.4 Create an array that has your favorite animals inside | ||
| 4.5 Log your array | ||
| 4.6 Ads Daan's favorite animal (baby pig) to the existing array |
There was a problem hiding this comment.
I assume you expect students to use push rather than modifying their array initialization in the source code. In that case we could say: Add a statement to adds Daan's...
remarcmij
left a comment
There was a problem hiding this comment.
Hi Maartje, excellent changes! I wonder however how much array manipulation you expect the students to be able to do at this point. See my detail comments below.
| 4.5 Log your array | ||
| 4.6 Ads Daan's favorite animal (baby pig) to the existing array | ||
| 4.7 Log your new array! | ||
| 4.8 Now add Gijs's favorite animal to the array (moose), but make sure it will be placed after the first animal that you have placed in your array. |
There was a problem hiding this comment.
To do this programmatically would require slice and concat (or array destructuring) but I note that we are teaching array manipulations in Week 3. So, perhaps you intend for the students to just add in the moose manually?
There was a problem hiding this comment.
no not really, I think I got a bit carried away here. I feel that there can always be a part of the homework that they have to figure out themselves. I've moved half of the questions to week 3 homework and now only ask then to add Daan's favourite animal to the array.
| 4.9 Write a console.log statement in which explain what _you think_ the new value of the array is. | ||
| 4.10 Log your new new array! | ||
| 4.11 Log the length of the array, add a message: "The array has a length of: "(here you should show the length of the array) | ||
| 4.12 Eyad does not like giraffes, delete this animal from the array |
There was a problem hiding this comment.
Again, do you expect them to use array manipulation?
| 5.2 Add the string to your file and console.log it. | ||
| 5.3 Find a way to get the length of `mystring`. | ||
| 5.4 Console.log the length of `mystring`. | ||
| 5.5 The comma's make that the sentence is quite hard to read. Find a way to remove the comma's from the sting and replace them with a spaces |
There was a problem hiding this comment.
typo: sting -> string. I would replace the commas with myString = myString.replace(/,/g, ' ') But that would mean we need explain what a regular expression and what the global flag does. BTW, I propose we hammer in the use of camelCase early, so can we make it myString?
There was a problem hiding this comment.
yes I agree, again also got a big carried away here, i moved half of the assignment to week3
|
|
||
|
|
||
| 7. Write a program that checks the types of two variables and prints out `SAME TYPE` if they are the same type. | ||
| 6.1 First declare at least four variables and assign them with different data types. |
|
|
||
| 7. Write a program that checks the types of two variables and prints out `SAME TYPE` if they are the same type. | ||
| 6.1 First declare at least four variables and assign them with different data types. | ||
| 6.2 For each variable write a console log statement that that logs the value |
There was a problem hiding this comment.
console.log, remove one 'that'
| 6.2 For each variable write a console log statement that that logs the value | ||
| ```js | ||
| let foo = 3 | ||
| console.log('My the value of my variable foo is: ' + foo) |
| let foo = 3 | ||
| console.log('My the value of my variable foo is: ' + foo) | ||
| ``` | ||
| 6.3 Now write a console.log statement weiring you first explain what you think the _type_ of your variables is. |
| ```js | ||
| let x = 9; | ||
| let y = 'Hello'; | ||
| let x = 9 |
There was a problem hiding this comment.
BTW are we doing semicolons or not? I remember from last discussion (don't remind Mauro) that we decided to use semi-colons, although I don't use them myself. Strongest supporter for semicolons was Rob but he out of the picture for the time being. The book that is on the reading list (Speaking JavaScript) actually recommends semicolons.
There was a problem hiding this comment.
I've added semicolons :)
| * Can you compare inifities? (Not in Eyad's world) - does 6/0 == 10/0? How can you test this? | ||
| 9. Write a program to answer the following questions: | ||
| 7.1 Can you store multiple types in an array? Numbers and strings? | ||
| 7.2 Can you compare inifities? (Not in Eyad's world) - does 6/0 == 10/0? How can you test this? |
…ented feedback from Jim about ;'s and language
| 4.7 Log your new array! | ||
| 4.8 Now add Gijs's favorite animal to the array (moose), but make sure it will be placed after the first animal that you have placed in your array. | ||
| 4.9 Write a console.log statement in which explain what _you think_ the new value of the array is. | ||
| 4.10 Log your new new array! |
fversnel
left a comment
There was a problem hiding this comment.
I like that we let them go through the mechanical part of creating and inspecting variables. I agree with Jim we should let the students name the variables themselves as naming is quite fundamental to writing readable code. They don't have to come up with good names at all yet at this stage, but let them come up with something
hi, I've made a first draft for how we can tweak the homework in a way that students have to think more about what is going on in their programs. My idea was that it would stimulate them to think more and not just type syntax. Also it requires them to actually know how to run the code, and be aquatinted with their basic environment setup, something some of them especially in early javascript have issues with. Would be cool if one of you can take a look and tell me what you think.