Konsolda ochilgan narsalarga ega bo'lish

Men console.log kabi ba'zi JSON va Google Chrome sukut bo'yicha ob'ektni o'ralgan. Ya'ni, JSON-dagi narsalarning global ko'rinishi bo'lishini istasam, har bir mulkni qo'l bilan qayta ochishim kerak. Ob'ektni butunlay chiqarib yuborishni istagan console.log ni aytish mumkinmi?

1

1 javoblar

console.dir and console.log wrap objects in that manner so they don't have to deal with recursion, which would cause an infinite loop. I don't believe there's a way to have it unwrap the entire object (for the aforementioned reason) with a special command.

JSONni "chiroyli" deb o'zgartirishingiz va barcha narsalarni mag'lubiyat sifatida ko'rishingiz mumkin:

console.log(JSON.stringify(JSON.parse(compressedJSON), null, 4));

Boshqa variant - JSONni JSONni tomosha qilish dasturiga joylashtirishdir ( Fiddler ning ichida joylashgan).

1
qo'shib qo'ydi
Rahmat! Cheksiz rekursiya muammosini bartaraf qilish uchun muayyan darajaga aniqlik kiritish haqida nima deyish mumkin?
qo'shib qo'ydi muallif Randomblue, manba
@Randomblue: Yo'q, buni mumkinligiga ishonmayman.
qo'shib qo'ydi muallif Andy E, manba
Javascript UZB
Javascript UZB
99 ishtirokchilar

@js_uzb @vuejs_uz @react_uz @nodejs_uz @angular_uz @ngTashkent @yiiframework_uz @laravel_uz @linux_uzbek @python_uz @swift_uzb —————— @uzdevgroup @UzGeeksGroup ——— @UzDev_Jobs @jobs_uzb