Aktywne Wpisy
Jakie zwierze do mieszkania sobie kupic? Pies wykluczony, kot wykluczony. Chce, by zwierze bylo czyste, niedrogie w utrzymaniu, zylo dlugo, nie paskudzilo.
szyderczy_szczur +52
Skopiuj link
Skopiuj linkWykop.pl
Podróże
Gospodarka
Ukraina
Technologia
Motoryzacja
Sport
Rozrywka
Informacje
Ciekawostki
console.log(min);
to mi się wyswietla w konsoliObject { test: 39.65, test1: 33.65, test2: 20.2 }
ale jak robie
console.log(min.test);
to dostaje 'undefined' o co biega?#javascript
JSON.parse: unexpected character at line 1 column 2 of the JSON data
, ale znalazłem coś takiegofor (var i in min){
console.log('key is '+i + ' value is '+min);}
tylko teraz w konsoli dostaje cos takeigo
key is test1 value is [object Object]
key is test2 value is [object Object]
key is test value is [object Object]
a jak zrobić teraz z tego obiekt Object { test: 39.65, test1: 33.65, test2: 20.2 }?
Próbuje coś takiego ale zamiast
test1
,test2
,test
, dostajei
var test3 ={};
for (var i in min){
console.log('key is '+i + ' value is '+min[i]);
test3 = {i : min[i]};
}
i tworzy mi tylko ostatnie pole tj 39.65
bo zamiast
console.log(min.test)
powinienem uzycconsole.log(min[' test'])
. Mam spacje przedtest
i dlatego nie moglem odwołać się do obiektu.