Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • May 10 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 25 17:12
    @mstellaluna banned @cmal
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:09
    thecodingaviator commented #31179
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:07
    thecodingaviator commented #31182
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator commented #31190
  • Apr 01 18:05
    thecodingaviator commented #31157
  • Apr 01 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

  • Apr 01 18:04
    thecodingaviator closed #31157
  • Apr 01 18:04
    thecodingaviator closed #33788
  • Apr 01 18:04
    thecodingaviator commented #33788
  • Apr 01 18:02
    thecodingaviator closed #31059
  • Apr 01 18:02
    thecodingaviator commented #31059
Abhishek Kumar
@Mr-Kumar-Abhishek
@AbbyLOL playerNumber should be just the number what you are looking for
AbbyLOL
@AbbyLOL
oh ok
Abhishek Kumar
@Mr-Kumar-Abhishek
@AbbyLOL such as 12 or 16
AbbyLOL
@AbbyLOL
what about player
Abhishek Kumar
@Mr-Kumar-Abhishek
@AbbyLOL and then use that number stored in that var to access the object
AbbyLOL
@AbbyLOL
oh ok thanks @Mr-Kumar-Abhishek
CamperBot
@camperbot
abbylol sends brownie points to @mr-kumar-abhishek :sparkles: :thumbsup: :sparkles:
:cookie: 390 | @mr-kumar-abhishek |http://www.freecodecamp.com/mr-kumar-abhishek
can anybody help me with this??
HELP
I son't really understand
HELp anybody
CamperBot
@camperbot
no wiki entry for: anybody
Jenky W. Nolasco
@jenkynolasco11
@
@AbbyLOL instead of switch(val), make it an object
And assign result to that lookup value
AbbyLOL
@AbbyLOL
val phoneticLookup = {
"alpha":"Adams",
"bravo":"Boston",
"charlie":"Chicago",
"delta":"Denver",
"echo":"Easy",
"foxtrot":"Frank"
};
Like this?
though it still doesn't work
Jenky W. Nolasco
@jenkynolasco11
Yeah, like that
But still, you gotta look it up using the bracket or dot notation, assign that value to return
AbbyLOL
@AbbyLOL
i don't really get it
Jenky W. Nolasco
@jenkynolasco11
So, you have this:
var obj = {
  1 : 'something',
  2 : 'like',
  3 : 'this'
}
you can get any value from there like this:
var str =  obj[1] // str has 'something'
That's bracket notation
You access the value via a bracket, using a key, which in this case, are 1, 2, and 3

You could also have this:

var key = 1
var str = obj[key] // str has 'something'

which is also the same

In case the object were like this:
var obj = {
 'key1' : 'something',
 'key 2' : 'like',
  key3 : 'this'
}
you could access each value via either bracket or dot notation
example:
AbbyLOL
@AbbyLOL
then what's wrong with my code
Jenky W. Nolasco
@jenkynolasco11
you have this:
switch(val) {
    "alpha":"Adams",
    "bravo":"Boston",
    "charlie":"Chicago",
    "delta":"Denver",
    "echo":"Easy"
    "foxtrot":"Frank"
  }
It's asking you to change it to an object, assign the result variable to the string given the val key, and return result
AbbyLOL
@AbbyLOL
var phoneticLookup = {
"alpha" : "Adams",
"bravo":"Boston",
"charlie":"Chicago",
"delta":"Denver",
"echo":"Easy",
"foxtrot":"Frank"
};
like this?
Jenky W. Nolasco
@jenkynolasco11
Yes
silver537
@silver537
that's half of it'
Jenky W. Nolasco
@jenkynolasco11
^
AbbyLOL
@AbbyLOL
then how should I further change it
silver537
@silver537
the other half: assign the result variable to the string given the val key, and return result
Jenky W. Nolasco
@jenkynolasco11
^^^
AbbyLOL
@AbbyLOL
var phoneticLookup = {
"alpha" : "Adams",
"bravo":"Boston",
"charlie":"Chicago",
"delta":"Denver",
"echo":"Easy",
"foxtrot":"Frank"
};
var phoneticLookup = ""
var str = phoneticLookup[undefined]
like this?
Jenky W. Nolasco
@jenkynolasco11
Uhm don't do the var phoneticLookup = ''
You already declared it as an object
silver537
@silver537
daaaaamn. did you read at all what ^ this guy said?
AbbyLOL
@AbbyLOL
i did...
silver537
@silver537
:point_up: November 6, 2016 10:35 PM
@AbbyLOL read carefully. he literally gives you the answer.