Admissions Challenge Redux Flashcards

1
Q

An […] is a collection of properties.

A

An object is a collection of properties. A set of properties are initialized in an object and can be added or removed.

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

Declare a variable named myArray and assign it to an empty array.

A

var myArray = [];

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

Populate myArray with two strings. Put your full name in the first string, and your Skype handle in the second.

A

myArray = [‘Ayan Said’, ‘validSkypeHandle’];

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

Declare a function named cutName. It should expect a parameter name.

*// you need to declare a function
// the function should be named cutName
// it should take one parameter, called name
// the function body should remain empty for this step*
A

function cutName(name) {

{

// function body will eventually go here

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

cutName should return an array by breaking up the input string into individual words.

A

function cutName(name) {

// set variable equal to name, split on a space

var splitName = name.split(‘ ‘);

// return newly created variable

return splitName;

}

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

Declare a new variable named myInfo and assign it to an empty object literal.

A

var myInfo = {};

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

Add the following three key-value pairs to myInfo:

  • Key: fullName, Value: The result of calling cutName on the name string within myArray.
  • Key: skype, Value: The Skype handle within myArray.
  • Key: github, Value: If you have a github handle, enter it here as a string. If not, set this to null instead.
A

var myInfo = {};

// Key: fullName, Value: The result of calling cutName on the name string within myArray.

myInfo.fullName = cutName(myArray[0]);

// Key: skype, Value: The Skype handle within myArray.

myInfo[‘skype’] = myArray[1];

// Key: github, Value: If you have a github handle, enter it here as a string. If not, set this to null instead.

myInfo.github = ‘githubHandle’;

// OR

myInfo.github = null;

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