This document provides an introduction to JavaScript for beginners. It covers JavaScript data types like numbers, strings, Booleans, objects, null, and undefined. It also covers JavaScript statements for storage like variables and constants, operators, and methods/functions. It demonstrates conditions using if/else statements and loops using for and while. It provides examples of arrays, strings, and built-in string methods. It includes pseudocode examples and exercises for beginners to practice writing JavaScript code for conditions, loops, arrays, strings, and functions.
17. Create an if statement
that will print out:
“If you are hungry and
thirsty, then drink & eat”
Exercise +,
18. Print out the numbers 1 to
8 using a for loop
Exercise ∞
19. Print out 5 times “Hey”
using a while loop.
Exercise .
20. Create this string variable:
var animal = “elephant”;
Then print out the
characters “p” & “t” of that
string
Exercise /
21. Print out the first element of
this array.
Exercise 0
22. Print out the first letter of the first
element of this array.
Exercise #
23. Print out the second element of this
array after having checked if it
started with a “B” by using an if
statement.
Exercise 1
24. Print out all names of this array by
using a for loop.
Exercise 2
25. Combine all you just learned to print
out all names that starts with a “B”.
You must use a for loop and an if
statement.
Exercise 3
26. Create a function that prints all students
names (on one line) that start with a specific
letter. The function takes two parameters:
1) An array of students 2) A letter
Exercise 4
27. Create a Dating “App” using a
function that takes 2 or more
arguments (hobbies / age / IQ…).
The function will tell you whether
this is a good match for you 5
Exercise 6