Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Markdown] Remove inline styles from JS reference #4118

Merged
merged 1 commit into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion files/en-us/web/javascript/eventloop/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h2 id="Runtime_concepts">Runtime concepts</h2>

<h3 id="Visual_representation">Visual representation</h3>

<p style="text-align: center;"><img alt="Stack, heap, queue" src="the_javascript_runtime_environment_example.svg"></p>
<p><img alt="Stack, heap, queue" src="the_javascript_runtime_environment_example.svg"></p>

<h3 id="Stack">Stack</h3>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,18 @@ <h2 id="The_employee_example">The employee example</h2>

<p>The remainder of this chapter uses the employee hierarchy shown in the following figure.</p>

<div style="display: table-row;">
<div style="display: table-cell; width: 350px; text-align: center; vertical-align: middle; padding: 10px;">
<p>A simple object hierarchy with the following objects:</p>

<p><img alt="" src="figure8.1.png"></p>
</div>

<div style="display: table-cell; vertical-align: middle; padding: 10px;">
<p>This shows an object hierarchy with the following objects:</p>

<ul>
<li><code>Employee</code> has the properties <code>name</code> (whose value defaults to the empty string) and <code>dept</code> (whose value defaults to "general").</li>
<li><code>Manager</code> is based on <code>Employee</code>. It adds the <code>reports</code> property (whose value defaults to an empty array, intended to have an array of <code>Employee</code> objects as its value).</li>
<li><code>WorkerBee</code> is also based on <code>Employee</code>. It adds the <code>projects</code> property (whose value defaults to an empty array, intended to have an array of strings as its value).</li>
<li><code>SalesPerson</code> is based on <code>WorkerBee</code>. It adds the <code>quota</code> property (whose value defaults to 100). It also overrides the <code>dept</code> property with the value "sales", indicating that all salespersons are in the same department.</li>
<li><code>Engineer</code> is based on <code>WorkerBee</code>. It adds the <code>machine</code> property (whose value defaults to the empty string) and also overrides the <code>dept</code> property with the value "engineering".</li>
</ul>
</div>
</div>


<h2 id="Creating_the_hierarchy">Creating the hierarchy</h2>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,41 +145,6 @@ <h3 id="Using_apply_to_chain_constructors">Using apply to chain constructors</h3
};
</pre>

<div class="note" style="height: 250px; overflow: auto;">
<p><strong>Note:</strong> The <code>Object.create()</code> method used above is relatively new. For alternative methods, please consider one of the following approaches:</p>

<p>Using {{jsxref("Object/proto", "Object.__proto__")}}:</p>

<pre class="brush: js">Function.prototype.construct = function (aArgs) {
let oNew = {};
oNew.__proto__ = this.prototype;
this.apply(oNew, aArgs);
return oNew;
};
</pre>

<p>Using <a href="/en-US/docs/Web/JavaScript/Closures">closures</a>:</p>

<pre class="brush: js">Function.prototype.construct = function(aArgs) {
let fConstructor = this, fNewConstr = function() {
fConstructor.apply(this, aArgs);
};
fNewConstr.prototype = fConstructor.prototype;
return new fNewConstr();
};</pre>

<p>Using the {{jsxref("Function")}} constructor:</p>

<pre class="brush: js">Function.prototype.construct = function (aArgs) {
let fNewConstr = new Function("");
fNewConstr.prototype = this.prototype;
let oNew = new fNewConstr();
this.apply(oNew, aArgs);
return oNew;
};
</pre>
</div>

<p>Example usage:</p>

<pre class="brush: js">function MyConstructor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ <h3 id="Calculating_the_height_of_an_equilateral_triangle">Calculating the heigh

<p>If we want to calculate the height of an equilateral triangle, and we know its side length is 100, we can use the formulae <em>length of the adjacent multiplied by the tangent of the angle is equal to the opposite.</em></p>

<p><img alt="" src="trigonometry.png" style="display: block; margin: 0 auto;"></p>
<p><img alt="" src="trigonometry.png"></p>

<p>In JavaScript, we can do this with the following:</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,12 @@ <h2 id="Description">Description</h2>

<p>When you calculate log(1 + x), you should get an answer very close to x, if x is small
(that's why these are called 'natural' logarithms).  If you calculate Math.log(1 +
1.1111111111e-15) you should get an answer close to 1.1111111111e-15.  Instead, <span
style="line-height: 1.5;">you will end up taking the logarithm of </span><span
style="line-height: 1.5;">1.00000000000000111022 (the roundoff is in binary so
sometimes it gets ugly)</span><span style="line-height: 1.5;">, so you
get </span><span style="line-height: 1.5;">the answer 1.11022...e-15, with only  3
correct digits.  If, instead, you calculate
Math.log1p(</span>1.1111111111e-15<span style="line-height: 1.5;">) you will get a
1.1111111111e-15) you should get an answer close to 1.1111111111e-15.  Instead,
you will end up taking the logarithm of 1.00000000000000111022 (the roundoff is in binary so
sometimes it gets ugly), so you get the answer 1.11022...e-15, with only  3
correct digits.  If, instead, you calculate Math.log1p(1.1111111111e-15) you will get a
much more accurate answer 1.1111111110999995e-15 with 15 correct digits of
precision (actually 16 in this case).</span></p>
precision (actually 16 in this case).</p>

<p>If the value of <code>x</code> is less than -1, the return value is always
{{jsxref("NaN")}}.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,18 @@ <h2 id="Description">Description</h2>
let result = re.exec('The Quick Brown Fox Jumps Over The Lazy Dog');
</pre>

<p>The following table shows the results for this script:</p>
<p>The following table shows the state of <code>result</code> after running this script:</p>

<table class="fullwidth-table standard-table">
<table class="standard-table">
<thead>
<tr>
<th scope="row">Object</th>
<th scope="col">Property/Index</th>
<th scope="col">Description</th>
<th scope="col">Example</th>
</tr>
</thead>
<tbody>
<tr>
<th rowspan="5" scope="row" style="vertical-align: top;"><code>result</code></th>
<td><code>[0]</code></td>
<td>The full string of characters matched</td>
<td><code>"Quick Brown Fox Jumps"</code></td>
Expand Down Expand Up @@ -128,8 +126,21 @@ <h2 id="Description">Description</h2>
<td>The original string that was matched against.</td>
<td><code>The Quick Brown Fox Jumps Over The Lazy Dog</code></td>
</tr>
</tbody>
</table>

<p>The following table shows the state of <code>re</code> after running this script:</p>

<table class="standard-table">
<thead>
<tr>
<th scope="col">Property/Index</th>
<th scope="col">Description</th>
<th scope="col">Example</th>
</tr>
</thead>
<tbody>
<tr>
<th rowspan="9" scope="row" style="vertical-align: top;"><code>re</code></th>
<td><code>lastIndex</code></td>
<td>
<p>The index at which to start the next match.</p>
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/javascript/typed_arrays/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ <h3 id="Typed_array_views">Typed array views</h3>
</tr>
<tr>
<td>{{jsxref("Float32Array")}}</td>
<td><code>1.2</code><span style="font-size: 1rem; letter-spacing: -0.00278rem;">×</span><code>10<sup>-38</sup></code> to <code>3.4</code><span style="font-size: 1rem; letter-spacing: -0.00278rem;">×</span><code>10<sup>38</sup></code></td>
<td><code>1.2</code>×<code>10<sup>-38</sup></code> to <code>3.4</code>×<code>10<sup>38</sup></code></td>
<td>4</td>
<td>32-bit IEEE floating point number (7 significant digits e.g., <code>1.123456</code>)</td>
<td><code>unrestricted float</code></td>
<td><code>float</code></td>
</tr>
<tr>
<td>{{jsxref("Float64Array")}}</td>
<td><code>5.0</code><span style="font-size: 1rem; letter-spacing: -0.00278rem;">×</span><code>10<sup>-324</sup></code> to <code>1.8</code><span style="font-size: 1rem; letter-spacing: -0.00278rem;">×</span><code>10<sup>308</sup></code></td>
<td><code>5.0</code>×<code>10<sup>-324</sup></code> to <code>1.8</code>×<code>10<sup>308</sup></code></td>
<td>8</td>
<td>64-bit IEEE floating point number (16 significant digits e.g., <code>1.123...15</code>)</td>
<td><code>unrestricted double</code></td>
Expand Down