@rumlows/

WheatForsakenCoin

JavaScript

No description

fork
loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.1999212325993054","path":"main.js","file":{"path":"main.js","content":{"asEncoding":{"base64":"Ci8vU2V0dXAKdmFyIGNvbnRhY3RzID0gWwogICAgewogICAgICAgICJmaXJzdE5hbWUiOiAiQWtpcmEiLAogICAgICAgICJsYXN0TmFtZSI6ICJMYWluZSIsCiAgICAgICAgIm51bWJlciI6ICIwNTQzMjM2NTQzIiwKICAgICAgICAibGlrZXMiOiBbIlBpenphIiwgIkNvZGluZyIsICJCcm93bmllIFBvaW50cyJdCiAgICB9LAogICAgewogICAgICAgICJmaXJzdE5hbWUiOiAiSGFycnkiLAogICAgICAgICJsYXN0TmFtZSI6ICJQb3R0ZXIiLAogICAgICAgICJudW1iZXIiOiAiMDk5NDM3MjY4NCIsCiAgICAgICAgImxpa2VzIjogWyJIb2d3YXJ0cyIsICJNYWdpYyIsICJIYWdyaWQiXQogICAgfSwKICAgIHsKICAgICAgICAiZmlyc3ROYW1lIjogIlNoZXJsb2NrIiwKICAgICAgICAibGFzdE5hbWUiOiAiSG9sbWVzIiwKICAgICAgICAibnVtYmVyIjogIjA0ODczNDU2NDMiLAogICAgICAgICJsaWtlcyI6IFsiSW50cmlndWluZyBDYXNlcyIsICJWaW9saW4iXQogICAgfSwKICAgIHsKICAgICAgICAiZmlyc3ROYW1lIjogIktyaXN0aWFuIiwKICAgICAgICAibGFzdE5hbWUiOiAiVm9zIiwKICAgICAgICAibnVtYmVyIjogInVua25vd24iLAogICAgICAgICJsaWtlcyI6IFsiSmF2YXNjcmlwdCIsICJHYW1pbmciLCAiRm94ZXMiXQogICAgfQpdOwoKCmZ1bmN0aW9uIGxvb2tVcFByb2ZpbGUoZmlyc3ROYW1lLCBwcm9wKXsKCiAgZm9yIChpPTA7IGk8Y29udGFjdHMubGVuZ3RoOyBpKyspIHsKICAgIGlmIChjb250YWN0c1tpXS5maXJzdE5hbWUgPT0gZmlyc3ROYW1lKSB7CiAgICBpZihjb250YWN0c1tpXS5oYXNPd25Qcm9wZXJ0eShwcm9wKSkgewogICAgICAgIHJldHVybiBjb250YWN0c1tpXVtwcm9wXTsKICAgICAgfSBlbHNlIHsKICAgICAgICByZXR1cm4gIk5vIHN1Y2ggcHJvcGVydHkiOyB9CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gIk5vIHN1Y2ggY29udGFjdCI7CiAgICB9IAogIH0gCn0KCi8vIENoYW5nZSB0aGVzZSB2YWx1ZXMgdG8gdGVzdCB5b3VyIGZ1bmN0aW9uCmxvb2tVcFByb2ZpbGUoIlNoZXJsb2NrIiwgImxpa2VzIik7Cg=="},"asBuffer":null},"loaded":true}}
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
36
37
38
39
40
41
42
43
44
45
46
47
//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){

  for (i=0; i<contacts.length; i++) {
    if (contacts[i].firstName == firstName) {
    if(contacts[i].hasOwnProperty(prop)) {
        return contacts[i][prop];
      } else {
        return "No such property"; }
    } else {
      return "No such contact";
    } 
  } 
}

// Change these values to test your function
lookUpProfile("Sherlock", "likes");
Native Browser JavaScript