Posts

Showing posts from August, 2017

Как отобразить объект JavaScript

Image
console . log ( obj ) str = JSON . stringify ( obj ); str = JSON . stringify ( obj , null , 4 ); // (Optional) beautiful indented output. console . log ( str ); // Logs output to dev tools console. alert ( str ); // Displays output using window.alert() Ссылка на Mozilla API Reference и другие примеры obj = JSON . parse ( str ); // Reverses above operation (Just in case if needed.) Источник: https://stackoverflow.com/questions/957537/how-can-i-display-a-javascript-object