UNPKG

ds-algo-study

Version:

Just experimenting with publishing a package

136 lines (133 loc) 5.42 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="description" content="A description of the page and its contents" /> <link rel="stylesheet" href="./../../assets/styles.css" /> <title>Page Title</title> <link rel="stylesheet" href="./../../../assets/style.css" /> <link rel="stylesheet" href="./../../../assets/prism.css" /> <script async src="./../../../assets/prism.js"></script> </head> <body> <h1 id="boolean-constructor">Boolean() constructor</h1> <blockquote> <p>The Boolean() constructor is used to create Boolean objects.</p> </blockquote> <p>The <strong><code>Boolean()</code></strong> constructor is used to create <a class="btn" href="chrome-extension://cjedbglnccaioiolemnfhjncicchinao/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean"><code>Boolean</code></a> objects.</p> <p>The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a class="btn" href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> and send us a pull request.</p> <h2 id="syntax">Syntax</h2> <p>new Boolean([value])</p> <h3 id="parameters">Parameters</h3> <p><code>value</code> Optional</p> <p>The initial value of the <code>Boolean</code> object.</p> <h2 id="examples">Examples</h2> <h3 id="creating-boolean-objects-with-an-initial-value-of-false">Creating <code>Boolean</code> objects with an initial value of <code>false</code></h3> pre data-role="codeBlock" data-info="js" class="language-javascript"><code>var bNoParam = new Boolean(); var bZero = new Boolean(0); var bNull = new Boolean(null); var bEmptyString = new Boolean(&#39;&#39;); var bfalse = new Boolean(false);</code></pre> <h3 id="creating-boolean-objects-with-an-initial-value-of-true">Creating <code>Boolean</code> objects with an initial value of <code>true</code></h3> pre data-role="codeBlock" data-info="js" class="language-javascript"><code>var btrue = new Boolean(true); var btrueString = new Boolean(&#39;true&#39;); var bfalseString = new Boolean(&#39;false&#39;); var bSuLin = new Boolean(&#39;Su Lin&#39;); var bArrayProto = new Boolean([]); var bObjProto = new Boolean({});</code></pre> <h2 id="specifications">Specifications</h2> <table> <colgroup> <col style="width: 100%" /> </colgroup> <thead> <tr > <th>Specification</th> </tr> </thead> <tbody> <tr> <td>[ECMAScript (ECMA-262)</td> </tr> <tr> <td>The definition of ‘Boolean constructor' in that specification.](https://tc39.es/ecma262/#sec-boolean-constructor) </td> </tr> </tbody> </table> <h2 id="browser-compatibility">Browser compatibility</h2> <p>The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a class="btn" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> <p><a class="btn" href="https://github.com/mdn/browser-compat-data">Update compatibility data on GitHub</a></p> <table> <colgroup> <col style="width: 25%" /> <col style="width: 25%" /> <col style="width: 25%" /> <col style="width: 25%" /> </colgroup> <thead> <tr > <th></th> <th>Desktop</th> <th>Mobile</th> <th>Server</th> </tr> </thead> <tbody> <tr> <td></td> <td>Chrome</td> <td>Edge</td> <td>Firefox</td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td><code>Boolean()</code> constructor</td> <td>Chrome Full support 1</td> <td>Edge Full support 12</td> <td>Firefox Full support 1</td> </tr> </tbody> </table> <h4 id="what-happens-next">What happens next?</h4> <p>Our team will review your report. Once we verify the information you have supplied we will update this browser compatability table accordingly.</p> <h4 id="can-i-keep-track-of-my-report">Can I keep track of my report?</h4> <p>You can join the GitHub repository to see updates and commits for this table data:</p> <p><a class="btn" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a></p> <p>Our goal is to provide accurate, real values for all our compatibility data tables. Notifying MDN of inaccurate data or supplying new data pushes us further towards our goal of providing 100% real values to the developer community.<br /> Thank you for helping.</p> <p>Please select the browser or browsers which are affected.</p> <p>Briefly outline the issue you are highlighting. Minimum 10 and maximum 1,000 characters.</p> <p>Browser documentation and release notes are good supporting items to accompany your message. A demo hosted on services like Codepen or JSBin are perfect for providing real examples of your findings.</p> <p>Connection error:Sorry, we can't seem to reach the server. We are working to fix the problem. Please try again later. </p> <h3 id="legend">Legend</h3> <p>Full support</p> <p>Full support</p> <h2 id="see-also">See also</h2> <ul> <li><a class="btn" href="chrome-extension://cjedbglnccaioiolemnfhjncicchinao/en-US/docs/Glossary/Boolean">Boolean</a> </li> </ul> <p><a class="btn" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean/Boolean">Source</a> </p> </body> </html>