Johan Kohlin
Lecturer at School of engineering, Jönköping University.
The Exam - solutions / The Group project / The Canvas
Room name: JKOHLIN
slides.com/jkohlin/tkpk18-lecture-8
function bpm(minutes,beats) {
/* your code here */
}
Write a function called bpm that takes 2 numbers as arguments: the length of a song in minutes, and the amount of beats in the song, as input
and calculates and returns the correct Beats Per Minute
function smallestNumber(arr) {
/* your code here */
}
smallestNumber is a function that takes any array of numbers (0-9) as input and returns the smallest number from that array.
function biggestNumber(num1, num2) {
var msg = " is the biggest number";
/* your code here */
}
Create a function that compares two numbers and returns a string that says "x is the biggest number", where x is the highest number passed to the function.
function isValidWalk(directions) {
/* your code here */
}
Create a function that will return true if the walk that the app gives you
will take you exactly ten minutes and will, of course, return you to your starting point. Return false otherwise.
isValidWalk(['n','s','e','w','n','n','n','s']) // false isValidWalk(['n','s','e','w','n','n','n','s','s','s']) // true
By Johan Kohlin