- Create a variable called length and assign a value to it
- Create a variable called width and assign a value to it
- Create a variable called area and assign to it the multiplication of length and width
- Print area in the following: "The result is " followed by the area variable BONUS: Print the area in the following syntax: "If the length of a rectangle is 5, and width is 3 then the area is: 15". Keep in mind that you should replace the numbers with their respective variables.
- Create an array named 'favorite_animals' that has four items:
- dog
- cat
- monkey
- rabbit
- After creating the array, replace the item that currently holds the value "rabbit" with another animal. It can be any animal you like.
- Then using an array method, remove 'cat' from the list.
- Using an array method, add an animal that you like.
- Print the list to test your code
- Create a function called cube
- It takes an argument called number
- It returns the cube of that number (the number to the power of 3)
- Call function to test it out
- Create a function called by_three
- It takes an argument called number
- If number is divisible by 3, by_three should call `cube(number) and return its result
- Otherwise, by_three should return false.
- Define a function called padel_court_cost. This function has two arguments, hours and court_type
- If the court_type is indoors, the padel court costs 30 KWD per hour.
- If the court_type is outdoors, the padel court costs 20 KWD per hour.
- The function calculates the padel court cost and returns it. BONUS: If the number of hours is three or more, the cost will be reduced by 20%.
- Create a function printer(elements)
- Accepts an array of temperature degrees
- Prints every element of the array followed by "C" for celsius
- Create a function to_celsius(temperatures)
- Accepts an array of temperatures in degrees Fahrenheit
- Returns an array of temperatures in degrees Celsius The conversion is: C = (F - 32) * (5/9)
- Write a function that will convert seconds into minutes and returns the minutes
- Write a function is_odd that receives number as an argument, and returns true if it's odd, false otherwise HINT: To check if a number is odd, if a number % 2 is 0 then it's even
- Write a function that returns the sum of the first and the last elements of an array. If you can, use arrow function 😉
- Write a function is_array_length_even that receives an array of numbers as an argument, and returns true if the array has an even number of elements, otherwise it returns false
- 6 students had taken CODED’s assessment. The results of the assessments were stored in an array. Write a function that returns the greatest score without using any built-in functions
- In a sorted list that includes the numbers 1-10, one number is missing. How do you find it using a function?