Module 1 - String Methods 1 Flashcards

1
Q

Write a function called “getFullName”. Given a first and a last name, “getFullName” returns a single string with the given first and last names separated by a single space.

A

function getFullName(firstName, lastName) {

return firstName + “ “ + lastName;

}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Write a function called “getLengthOfWord”. Given a word, “getLengthOfWord” returns the length of the given word.

A

function getLengthOfWord(word) {
return word.length;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Write a function called “getLengthOfTwoWords”. Given 2 words, “getLengthOfTwoWords” returns the sum of their lengths.

A

function getLengthOfTwoWords(word1, word2) {

return word1.length + word2.length;

}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly