Jump to content
php.lv forumi
  • 0

JS Objects


Question

Posted

Labdien.

Mācoties codeacademy, uzskrēju virsū uzdevumam, kura nosacījumi šādi:

 

Add some friend objects to your friendobject. You can add as many as you like, but make sure you add at least one called billand one called steve (note the lack of capitalization). Check the Hint if you need help.

 

Kods man sanāca šāds:

var friends = {
	friends.Davis = {
		name = 'Jim',
		lastName = 'Mofo',
		phoneNumber = 'unknown'
},
	friends.bill = {
		name = 'Steve',
		lastName = 'Binghem',
		phoneNumber = '231456455465'
},
	friends.steve = {
		name = 'Bill',
		lastName = 'Fucker',
		phoneNumber = 'unknown'
}
};

 

Bet parādās kļūdas, draugam prasīju, šis nezin, kur problēma.

 

SyntaxError: Unexpected token .
Oops, try again.
Did you add bill to the friends object?

7 answers to this question

Recommended Posts

  • 0
Posted

JSON or JavaScript Object Notation, is a text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects.

  • 0
Posted

JSON or JavaScript Object Notation, is a text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects.

Tu laikam nesaproti.

Ja pašā Javascriptā pastāv pareizā sintakse, kā uzrakstīt objektus, tad es nevēlos neko citu izmantot, kā tikai Javascript!

Ja Tev vēl kas sakāms sakarā ar JSON, tad labāk neko neraksti, ja Tev nedalec.

  • 0
Posted

JSON, mle!

 

Tev ir sintakses kļūda. Jebkurš JSON ir valīds JS, tāpēc paskaties kāda ir JSON sintakse.

  • 0
Posted

Tu laikam nesaproti.

Ja pašā Javascriptā pastāv pareizā sintakse, kā uzrakstīt objektus, tad es nevēlos neko citu izmantot, kā tikai Javascript!

Ja Tev vēl kas sakāms sakarā ar JSON, tad labāk neko neraksti, ja Tev nedalec.

Tev cenšas palīdzēt, jo tu pats to lūdzi. Tagad tu saki, lai neko neraksta. Jocīgi.

  • 0
Posted

Izpalīdzīgā tauta ir izpalīdzīga.

var friends = {
  Davis: {
    name: 'Jim',
    lastName: 'Mofo',
    phoneNumber: 'unknown'
  },
  bill: {
    name: 'Steve',
    lastName: 'Binghem',
    phoneNumber: '231456455465'
  },
  steve: {
    name: 'Bill',
    lastName: 'Fucker',
    phoneNumber: 'unknown'
  }
};

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...