forked from TheOdinProject/javascript-exercises
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjoinStrings-solution.js
More file actions
35 lines (27 loc) · 1.18 KB
/
joinStrings-solution.js
File metadata and controls
35 lines (27 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
First name: Carlos
Last name: Stevenson
This year: 1965
Birth year: 1947
The greeting should read: "Hello! My name is Carlos Stevenson and I am 18 years old."
*/
// Add your code right below, good luck!
const firstName = "Carlos";
const lastName = "Stevenson";
const thisYear = 1965;
const birthYear = 1947;
// At first, greeting may look like this:
// const greeting = "Hello! My name is " + firstName + " " + lastName + " and I am " + (thisYear - birthYear) + " years old.";
const fullName = firstName + " " + lastName;
const age = thisYear - birthYear;
// At the end of the exercise, greeting may look like this:
const greeting = "Hello! My name is " + fullName + " and I am " + age + " years old.";
module.exports = {
firstName: typeof firstName === 'undefined' ? undefined : firstName,
lastName: typeof lastName === 'undefined' ? undefined : lastName,
thisYear: typeof thisYear === 'undefined' ? undefined : thisYear,
birthYear: typeof birthYear === 'undefined' ? undefined : birthYear,
greeting: typeof greeting === 'undefined' ? undefined : greeting,
fullName: typeof fullName === 'undefined' ? undefined : fullName,
age: typeof age === 'undefined' ? undefined : age
}