what is con­sole

Sim­ply send­ing out log­ging in­for­ma­tion via con­sole.log reeks of the 1990s. Why not use some ad­vanced fea­tures in­stead?

Web Designer - - Design Develop Create -

One of the defin­ing fea­tures of An­droid is Log­cat — de­vel­op­ers can emit log­ging mes­sages with var­i­ous lev­els of sever­ity. Chrome also sup­ports this fea­ture. Sim­ply use one of the fol­low­ing meth­ods: con­sole.de­bug() == con­sole.log() con­sole.info() con­sole.warn() con­sole.er­ror() Chrome’s con­sole is not lim­ited to dis­play­ing in­for­ma­tion. You can also in­ter­act with the con­tent of your web­site in a fash­ion not dis­sim­i­lar to Pow­er­shell or BASH. When work­ing on code, be care­ful to look at the combo box at the top of the screen. It let’s you se­lect where Javascript will run – many types of con­tent live in their own iframe. They can­not be reached by code en­tered into the top ex­e­cu­tion con­text. Once the right ex­e­cu­tion area is se­lected, chang­ing the con­tent of el­e­ments is as easy as en­ter­ing a sin­gle com­mand: doc­u­ment.getele­ment­byid('change­my­text'). textcon­tent = 'Hello' Chrome’s con­sole tends to flood once pro­jects get com­plex. This is ad­dressed by col­lat­ing sim­i­lar mes­sages. Click a but­ton five times, and emit the same mes­sage each time — it will show up once. Dis­able this by open­ing Set­tings > Gen­eral. Then, check the Show Times­tamps op­tion. Al­ter­na­tively, in­tro­duce tags and use the Fil­ter fea­ture.

Newspapers in English

Newspapers from UK

© PressReader. All rights reserved.