javascript-vs-ruby
A comparison between Ruby and JavaScript is presented for a range of problems and data types. Flick between the .rb and .js to compare what is similar and what is different between the two languages.
The following challenges are for JavaScript.
If you find any too hard, get help from your teachers or fellow students, or try doing it in Ruby first.
Challenges
1.js
- Create variables for Anzac Day, and output them
- Change your code to use the Date class — hint:
new Date(…)
2.js
- Convert the lengths to yards, and output them
- Find the longest fish, and output it
- Create a sorted copy of the centimetre lengths array, and output it
3.js
- Add another three movies
- Add a property for director to each movie, and display it
- Convert people from being strings (
Tom Hanks
) to objects (with e.g. first & last name)
4.js
- Skip conjuctions (and / or / the / of) from
wordFrequencyTable
function - Skip conjuctions (and / or / the / of) from
wordCount
function - Change the sentence to the "It was the best of times…" chapter 1 excerpt from here: https://en.wikiquote.org/wiki/A_Tale_of_Two_Cities
- Find the five most popular words using the result of
wordFrequencyTable
5.js
- Add a
removeItem(item)
method - Add a
sortItems()
method to sort alphabetically