Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

JavaScript

Object recomendable declaration

1
2
3
4
5
6
// Good
var web = {
    title: "MyWebsite",
    url: "http://localhost/",
    category: "blog"
};
https://snipt.net/embed/defc9439d4b648be0951d7b7de373540/
https://snipt.net/raw/defc9439d4b648be0951d7b7de373540/
defc9439d4b648be0951d7b7de373540
js
JavaScript
6
2016-12-04T12:43:20
True
False
False
Feb 18, 2013 at 10:50 AM
/api/public/snipt/55952/
object-recomendable-declaration
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">// Good</span> </span><span id="L-2"><a name="L-2"></a><span class="kd">var</span> <span class="nx">web</span> <span class="o">=</span> <span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="nx">title</span><span class="o">:</span> <span class="s2">&quot;MyWebsite&quot;</span><span class="p">,</span> </span><span id="L-4"><a name="L-4"></a> <span class="nx">url</span><span class="o">:</span> <span class="s2">&quot;http://localhost/&quot;</span><span class="p">,</span> </span><span id="L-5"><a name="L-5"></a> <span class="nx">category</span><span class="o">:</span> <span class="s2">&quot;blog&quot;</span> </span><span id="L-6"><a name="L-6"></a><span class="p">};</span> </span></pre></div> </td></tr></table>
javascript, object, syntax
Copyrighted, illegal, or inappropriate content? Email [email protected].