
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Latest News</title>
<link>https://sl.ymaws-qa.com/news/default.asp</link>
<description><![CDATA[ Keep up-to-date with the latest news straight from&nbsp;us to you! ]]></description>
<lastBuildDate>Wed, 6 May 2026 15:22:33 GMT</lastBuildDate>
<pubDate>Tue, 17 Jul 2018 19:17:52 GMT</pubDate>
<copyright>Copyright &#xA9; 2018 QA SocialLink</copyright>
<atom:link href="https://sl.ymaws-qa.com/news/news_rss.asp?cat=2276" rel="self" type="application/rss+xml"></atom:link>
<item>
<title>MEMBERSHIP - 1196 - Active</title>
<link>https://sl.ymaws-qa.com/news/news.asp?id=11413</link>
<guid>https://sl.ymaws-qa.com/news/news.asp?id=11413</guid>
<description><![CDATA[This is an Active news article.]]></description>
<pubDate>Tue, 17 Jul 2018 20:17:52 GMT</pubDate>
</item>
<item>
<title>How you can improve your workflow using the JavaScript console</title>
<link>https://sl.ymaws-qa.com/news/news.asp?id=11402</link>
<guid>https://sl.ymaws-qa.com/news/news.asp?id=11402</guid>
<description><![CDATA[<div class="content">
<div class="moz-reader-content line-height4">
<div id="readability-page-1" class="page">
<div data-post-id="bdd7823a9472" data-source="post_page" data-collection-id="336d898217ee" data-tracking-context="postPage" data-scroll="native"><section name="58c2">
<div>
<p name="849a" id="849a">As a web developer, you know very well the need to debug your code. We often use external libraries for logs, and to format and/or display them in some cases, but the console of our browsers is much more powerful than we think.</p>
<p name="7cf1" id="7cf1">When we think about the console, the first thing that comes to mind and the <code>console.log</code>, right? But there are many more methods than those we imagine. Now we will see how to make the most of using the console, and I’ll give you some tips to make them these methods more readable</p>
<h3 name="f739" id="f739">What is the&nbsp;Console?</h3>
<p name="0088" id="0088">The JavaScript console is a built-in feature in modern browsers that comes with out-of-the-box development tools in a shell-like interface. It allows a developer to:</p>
<ul>
    <li name="28c6" id="28c6">View a log of errors and warnings that occur on a web page.</li>
    <li name="d21c" id="d21c">Interact with the web page using JavaScript commands.</li>
    <li name="2741" id="2741">Debug applications and traverse the DOM directly in the browser.</li>
    <li name="2fdd" id="2fdd">Inspect and analyze network activity</li>
</ul>
<p name="14e0" id="14e0">Basically, it empowers you to write, manage, and monitor JavaScript right within your browser.</p>
<h4 name="3def" id="3def">Console.log, Console.error, Console.warn and Console.info</h4>
<p name="28d2" id="28d2">These are probably the most used methods of all. You can pass more than one parameter to these methods. Each parameter is evaluated and concatenated in a string delimited by the space, but in case of objects or arrays you can navigate between their properties.</p>
<figure name="3738" id="3738">
<div>&nbsp;</div>
</figure>
<h4 name="bcc8" id="bcc8">Console.group</h4>
<p name="3c9e" id="3c9e">This method allows you to group a series of console.logs (but also error info, and so on) under a group that can be collapsed. The syntax is really very simple: just enter all the <code>console.log</code> we want to group before a <code>console.group()</code> (or <code>console.groupCollapsed()</code> if we want it to be closed by default). Then add a <code>console.groupEnd()</code> at the end to close the group.</p>
</div>
<div><figure name="b955" id="b955" data-scroll="native">
<div>&nbsp;</div>
<figcaption>Example of how to use the console.group</figcaption></figure></div>
<div>
<p name="98c4" id="98c4">The results will look like this:</p>
<figure name="5a3c" id="5a3c">
<div>&nbsp;</div>
</figure>
<h4 name="b59b" id="b59b">Console.table</h4>
<p name="853e" id="853e">Since I discovered the <code>console.table</code> my life has changed. Displaying JSON or very large JSON arrays inside a <code>console.log</code> is a terrifying experience. The <code>console.table</code> allows us to visualize these structures inside a beautiful table where we can name the columns and pass them as parameters.</p>
</div>
<div><figure name="649c" id="649c" data-scroll="native">
<div>&nbsp;</div>
<figcaption>Example of how to use the console.table</figcaption></figure></div>
<div>
<p name="2302" id="2302">The result is wonderful and very useful in debugging:</p>
<figure name="2136" id="2136">
<div>&nbsp;</div>
</figure>
<h4 name="76e2" id="76e2">Console.count, Console.time and Console.timeEnd</h4>
<p name="dd1f" id="dd1f">These three methods are the Swiss army knife for every developer who needs to debug. The <code>console.count</code> counts and outputs the number of times that <code>count()</code> has been invoked on the same line and with the same label. The <code>console.time</code> starts a timer with a name specified as an input parameter, and can run up to 10,000 simultaneous timers on a given page. Once initiated, we use a call to <code>console.timeEnd</code> to stop the timer and print the elapsed time to the Console.</p>
</div>
<div><figure name="1735" id="1735" data-scroll="native">
<div>&nbsp;</div>
<figcaption>Example of how to use the console.time and console.count</figcaption></figure></div>
<div>
<p name="968a" id="968a">The output will look like this:</p>
<figure name="95cf" id="95cf">
<div>&nbsp;</div>
</figure>
<h4 name="50b5" id="50b5">Console.trace and Console.assert</h4>
<p name="fbe6" id="fbe6">These methods simply print a stack trace from the point where it was called. Imagine you are creating a JS library and want to inform the user where the error was generated. In that case, these methods can be very useful. The <code>console.assert</code> is like the <code>console.trace</code> but will print only if the condition passed didn’t pass.</p>
</div>
<div>
<p name="9f3a" id="9f3a">As we can see, the output is exactly what React (or any other library) would show us when we generate an exception.</p>
<figure name="196b" id="196b">
<div>&nbsp;</div>
</figure>
<h3 name="1739" id="1739">Delete all the Consoles&nbsp;🙀</h3>
<p name="332e" id="332e">Using consoles often forces us to eliminate them. Or sometimes we forget about the production build (and only notice them by mistake days and days later). Of course, I do not advise anyone to abuse consoles where they are not needed (the console in the change input handle can be deleted after you see that it works). You should leave error logs or trace logs in development mode to help you debug. I use Webpack a lot, both at work and in my own projects. This tool allows you to delete all the consoles that you do not want to remain (by type) from the production build using the <a href="https://github.com/webpack-contrib/uglifyjs-webpack-plugin" data-href="https://github.com/webpack-contrib/uglifyjs-webpack-plugin" rel="noopener" target="_blank">uglifyjs-webpack-plugin</a> 😌</p>
<pre name="b1e8" id="b1e8"><code>const UglifyJsPlugin = require('uglifyjs-webpack-plugin')<br />var debug = process.env.NODE_ENV !== "production";</code></pre>
<p>.....</p>
<pre name="b1e8" id="b1e8"><code><br />optimization: {<br /> minimizer: !debug ? [<br /> new UglifyJsPlugin({<br /> // Compression specific options<br /> uglifyOptions: {<br /> // Eliminate comments<br /> comments: false,<br /> compress: {<br /> // remove warnings<br /> warnings: false,<br /> // Drop console statements<br /> drop_console: true<br /> },<br /> }<br /> })] : []<br />}</code></pre>
<p name="bcaa" id="bcaa">The configuration is really trivial and it simplifies the work, so have fun with the console (but do not abuse it!)</p>
</div>
</section><section name="1166"><blockquote name="9645" id="9645">If you liked the article please clap and follow me&nbsp;:)&nbsp;<br />
Thx and stay tuned 🚀<br />
Follow my last news and tips on <a href="https://www.facebook.com/CanellaRiccardo/" data-href="https://www.facebook.com/CanellaRiccardo/" rel="noopener" target="_blank">Facebook</a></blockquote></section></div>
</div>
</div>
</div>]]></description>
<pubDate>Thu, 14 Jun 2018 13:05:43 GMT</pubDate>
</item>
</channel>
</rss>
