DEV Community

Cover image for JavaScript Tutorial Series: Practice 1
The daily developer
The daily developer

Posted on • Updated on

JavaScript Tutorial Series: Practice 1

In this post we're going to use everything we learned by solving exercises. I will not provide the solution to the exercises simply because they can be found online. Do keep in mind that, copying and pasting will not be in your favor simply because it won't be beneficial to you.

Try on your own first, and keep trying, do not look the solutions up unless you've spend some time on these exercises.
If you feel stuck you can use the previous lessons.

Exercise 1

Write a function that returns the largest number between three that you will provide when calling it. Print the answer in the console.

Exercise 2

Write a function that returns the third character in a string. print this character to the console.

Exercise 3

Without using the console, what is the output of these?

  • let numbers = [3, 5, 8, 9, 12, 67]; let newArr = numbers.slice(1, 4);
function myFunc() {
  let a = 7;
  console.log(a);
}
console.log(a);

Enter fullscreen mode Exit fullscreen mode
  • write a function that returns the length of a string you will pass as argument and print it in the console.

  • write a program that joins two string in two different ways.

  • Write a function that returns the string with the largest length. and print it to the console.

These exercises are very easy! good luck!

Top comments (0)