Get help on our basic JavaScript and Algorithms Challenges. If you are posting code that is large use Gist - https://gist.github.com/ paste the link here.
thecodingaviator on master
remove A (#31157) (compare)
//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
"firstName": "Sherlock",
"lastName": "Holmes",
"number": "0487345643",
"likes": ["Intriguing Cases", "Violin"]
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["Javascript", "Gaming", "Foxes"]
}
];
function lookUpProfile(firstName, prop){
// Only change code below this line
if(contacts.hasOwnProperty(firstName) && contacts.hasOwnProperty(prop))
return contacts[prop];
else if(contacts.hasOwnProperty(firstName))
return "No such contact";
// Only change code above this line
}
// Change these values to test your function
lookUpProfile("Akira", "likes");
:star2: 1528 | @masd925 |http://www.freecodecamp.com/masd925
:star2: 1825 | @blauelf |http://www.freecodecamp.com/blauelf
```js ⇦ Type 3 backticks and then press [shift + enter ⏎]
(type js or html or css)
<paste your code here>,
then press [shift + enter ⏎]
``` ⇦ Type 3 backticks, then press [enter ⏎]
This an inline `<paste code here>
` code formatting with a single backtick() at _start_ and _end_ around the
code`.
See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics
Hi all, I'm trying to split each word of a string into seperate arrays of alphabets, within a larger array of the whole string. What I'm looking for is this ["I","'","m"] ["a"]["l","i","t","t","l","e"]...you get the point,
but I'm stumped on how to split the words, can anybody help?
```
function titleCase(str) {
var splitOnce = str.split(" ");
for (var i=0; i <splitOnce.length; i++){
var splitTwice = splitOnce[[i][i]].split("");
return splitTwice;
}
}
titleCase("I'm a little tea pot");
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
"when i saw a " + myAdjective + myNoun + "i " + myVerb + myAdverb;
// Your code above this line
return result;
}
// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
result = "when i saw a " + myAdjective + myNoun + "i " + myVerb + myAdverb;
// Your code above this line
return result;
}
// Change the words here to test your function
wordBlanks("dog ", "big ", "ran ", "quickly ");