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

Remove sup from javascript docs #5128

Merged
merged 7 commits into from
May 21, 2021
Merged

Conversation

wbamberg
Copy link
Collaborator

As discussed in #4578 and in particular #4578 (comment), I've gone through the JS docs, replacing <sup> with caret, or the ordinal word like "first", and in one case removing it entirely.

One case that needed care is 2<sup>63</sup>-1, which renders like:

263-1

...but gives the less readable (to my eye)

2^63-1

...when converted. Many of these already used spaces:

263 - 1

...but I've tried to make sure that they all do, so we get:

2^63 - 1

...which looks better to me.

@wbamberg wbamberg requested a review from a team as a code owner May 19, 2021 19:41
@wbamberg wbamberg requested review from sideshowbarker and removed request for a team May 19, 2021 19:41
@wbamberg wbamberg changed the title Remove sup javascript Remove sup from javascript docs May 19, 2021
@github-actions
Copy link
Contributor

github-actions bot commented May 19, 2021

Preview URLs

Flaws

Note! 30 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters
Title: Rest parameters
on GitHub
Flaw count: 2

  • broken_links:
    • Can't resolve https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
    • Is currently http:// but can become https://

URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Number
Title: Number
on GitHub
Flaw count: 1

  • macros:
    • /en-US/docs/Web/JavaScript/Reference/Arithmetic%20operators does not exist

URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger
Title: Number.isSafeInteger()
on GitHub
Flaw count: 1

  • broken_links:
    • Is currently http:// but can become https://

URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
Title: TypedArray
on GitHub
Flaw count: 1

  • macros:
    • /en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/prototype redirects to /en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray

URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Array
Title: Array() constructor
on GitHub
Flaw count: 1

  • broken_links:
    • Anchor not lowercase

URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from
Title: Array.from()
on GitHub
Flaw count: 1

  • broken_links:
    • Can't resolve /en-US/docs/Web/JavaScript/Guide/iterable

URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
Title: Array.prototype.forEach()
on GitHub
Flaw count: 2

  • broken_links:
    • Anchor not lowercase
    • No need for the pathname in anchor links if it's the same page

URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt
Title: parseInt()
on GitHub
Flaw count: 1

  • broken_links:
    • Anchor not lowercase

URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind
Title: Function.prototype.bind()
on GitHub
Flaw count: 1

  • macros:
    • /en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype does not exist

URL: /en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_NOT
Title: Bitwise NOT (~)
on GitHub
Flaw count: 2

  • broken_links:
    • Anchor not lowercase
  • bad_pre_tags:
    • <pre><code>CODE can be just <pre>CODE

URL: /en-US/docs/Web/JavaScript/Data_structures
Title: JavaScript data types and data structures
on GitHub
Flaw count: 1

  • broken_links:
    • Can't resolve /en-US/docs/Storage

URL: /en-US/docs/Web/JavaScript/Typed_arrays
Title: JavaScript typed arrays
on GitHub
Flaw count: 2

  • broken_links:
    • Can't resolve /en-US/docs/Code_snippets/StringView
    • Is currently http:// but can become https://

URL: /en-US/docs/Web/JavaScript/Language_Resources
Title: JavaScript language resources
on GitHub
Flaw count: 8

  • broken_links:
    • Is currently http:// but can become https://
    • Is currently http:// but can become https://
    • Can't resolve /en-US/docs/JavaScript/ECMAScript_5_support_in_Mozilla
    • Can't resolve /en-US/docs/E4X
    • Is currently http:// but can become https://
    • and 3 more flaws omitted

URL: /en-US/docs/Web/JavaScript/About_JavaScript
Title: About JavaScript
on GitHub
Flaw count: 5

  • broken_links:
    • Can't resolve /en-US/docs/Rhino
    • Is currently http:// but can become https://
    • Is currently http:// but can become https://
    • Is currently http:// but can become https://
    • Can't resolve /en-US/docs/Rhino

External URLs

URL: /en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript
Title: A re-introduction to JavaScript (JS tutorial)
on GitHub


URL: /en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters
Title: Rest parameters
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Errors/Resulting_string_too_large
Title: RangeError: repeat count must be less than infinity
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Number
Title: Number
on GitHub


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger
Title: Number.isSafeInteger()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_SAFE_INTEGER
Title: Number.MIN_SAFE_INTEGER
on GitHub


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_VALUE
Title: Number.MIN_VALUE
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON
Title: Number.EPSILON
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE
Title: Number.MAX_VALUE
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
Title: Number.MAX_SAFE_INTEGER
on GitHub


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Math
Title: Math
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/exp
Title: Math.exp()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow
Title: Math.pow()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/expm1
Title: Math.expm1()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot
Title: Math.hypot()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random
Title: Math.random()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
Title: TypedArray
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every
Title: Array.prototype.every()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Array
Title: Array() constructor
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from
Title: Array.from()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice
Title: Array.prototype.splice()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
Title: Array.prototype.forEach()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some
Title: Array.prototype.some()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length
Title: Array.prototype.length
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode
Title: String.fromCharCode()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt
Title: parseInt()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind
Title: Function.prototype.bind()
on GitHub

No external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply
Title: Function.prototype.apply()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse
Title: Date.parse()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/UTC
Title: Date.UTC()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now
Title: Date.now()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
Title: BigInt
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt/asUintN
Title: BigInt.asUintN()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt/asIntN
Title: BigInt.asIntN()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
Title: Object.prototype.toString()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_NOT
Title: Bitwise NOT (~)
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Data_structures
Title: JavaScript data types and data structures
on GitHub


URL: /en-US/docs/Web/JavaScript/Typed_arrays
Title: JavaScript typed arrays
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Language_Resources
Title: JavaScript language resources
on GitHub


URL: /en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators
Title: Expressions and operators
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Guide/Control_flow_and_error_handling
Title: Control flow and error handling
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Guide/Indexed_collections
Title: Indexed collections
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Guide/Numbers_and_dates
Title: Numbers and dates
on GitHub


URL: /en-US/docs/Web/JavaScript/About_JavaScript
Title: About JavaScript
on GitHub

(this comment was updated 2021-05-21 05:29:55.409297)

@hamishwillee hamishwillee self-requested a review May 21, 2021 01:49
@@ -11,7 +11,7 @@

<h2 id="What_is_JavaScript">What is JavaScript?</h2>

<p><strong>JavaScript</strong><sup>®</sup> (often shortened to <strong>JS</strong>) is a lightweight, interpreted, object-oriented language with <a href="https://en.wikipedia.org/wiki/First-class_function">first-class functions</a>, and is best known as the scripting language for Web pages, but it's <a href="https://en.wikipedia.org/wiki/JavaScript#Uses_outside_Web_pages">used in many non-browser environments</a> as well. It is a <a class="mw-redirect" href="https://en.wikipedia.org/wiki/Prototype-based_programming" title="Prototype-based">prototype-based</a>, multi-paradigm scripting language that is dynamic, and supports object-oriented, imperative, and functional programming styles.</p>
<p><strong>JavaScript</strong> (often shortened to <strong>JS</strong>) is a lightweight, interpreted, object-oriented language with <a href="https://en.wikipedia.org/wiki/First-class_function">first-class functions</a>, and is best known as the scripting language for Web pages, but it's <a href="https://en.wikipedia.org/wiki/JavaScript#Uses_outside_Web_pages">used in many non-browser environments</a> as well. It is a <a class="mw-redirect" href="https://en.wikipedia.org/wiki/Prototype-based_programming" title="Prototype-based">prototype-based</a>, multi-paradigm scripting language that is dynamic, and supports object-oriented, imperative, and functional programming styles.</p>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am assuming that since I've not seen it before on MDN we don't generally markup the use of trademarks, copyrights etc. If so, good.

@@ -377,31 +377,31 @@ <h3 id="Indexed_collections_Arrays_and_typed_Arrays">Indexed collections: Arrays
</tr>
<tr>
<td>{{jsxref("Float32Array")}}</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><code>1.2</code>×<code>10^-38</code> to <code>3.4</code>×<code>10^38</code></td>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better for base 10 exponentials to represent using E, as this is well understood (even by me): E.g.1.2×10^-38 to 1.2E-38

<td>4</td>
<td>32-bit IEEE floating point number (7 significant digits e.g., <code>1.1234567</code>)</td>
<td><code>unrestricted float</code></td>
<td><code>float</code></td>
</tr>
<tr>
<td>{{jsxref("Float64Array")}}</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><code>5.0</code>×<code>10^-324</code> to <code>1.8</code>×<code>10^308</code></td>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use E? https://github.com/mdn/content/pull/5128/files#r636583402

I won't mark up any more of these.

@@ -23,23 +23,23 @@
<th colspan="4">Current editions</th>
</tr>
<tr>
<td>ECMA-262 11<sup>th</sup> Edition</td>
<td>ECMA-262 eleventh Edition</td>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why, but it feels like eleventh should be capitalised or edition should not be. My preference: "ECMA-262 (eleventh edition)"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually my preference is: ECMA-262 11th Edition.
I don't care that the sub is missing, it just looks better.

<td>
<p><a href="https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf">PDF</a>, <a href="https://ecma-international.org/ecma-262/11.0/index.html">HTML</a>, <a href="https://tc39.github.io/ecma262/">Working draft</a>, <a href="https://github.com/tc39/ecma262">repository</a></p>
</td>
<td>2020</td>
<td>ECMAScript 2020 Language Specification</td>
</tr>
<tr>
<td>ECMA-262 10<sup>th</sup> Edition</td>
<td>ECMA-262 tenth Edition</td>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for https://github.com/mdn/content/pull/5128/files#r636584266 - just looks wrong to have the case go up and down. Ignore if you want.


<pre class="brush: js">var namelistA = new Array(4294967296); //2 to the 32nd power<sup> = </sup>4294967296
<pre class="brush: js">var namelistA = new Array(4294967296); //2 to the 32nd power = 4294967296
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want to point out that we're happy to have "32nd" here. I think using first is better, but I would not be offended by 1st, 2nd, etc.

@@ -33,7 +33,7 @@ <h3 id="Parameters">Parameters</h3>
<h3 id="Returns">Returns</h3>

<p>The value of <code><var>bigint</var></code> modulo
2<sup><code><var>bits</var></code></sup>, as an unsigned integer.</p>
2^<code><var>bits</var></code>, as an unsigned integer.</p>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix is OK, but would have killed the <var> markup too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will go in the Markdown conversion (there are a billion on them).

@@ -75,7 +75,7 @@ <h2 id="Static_methods">Static methods</h2>
<dt>{{jsxref("Global_Objects/Math/cosh", "Math.cosh(<var>x</var>)")}}</dt>
<dd>Returns the hyperbolic cosine of <code><var>x</var></code>.</dd>
<dt>{{jsxref("Global_Objects/Math/exp", "Math.exp(<var>x</var>)")}}</dt>
<dd>Returns <code>E<var><sup>x</sup></var></code>, where <code><var>x</var></code> is the argument, and <code>E</code> is Euler's constant (<code>2.718</code>…, the base of the natural logarithm).</dd>
<dd>Returns <code>E<var>^x</var></code>, where <code><var>x</var></code> is the argument, and <code>E</code> is Euler's constant (<code>2.718</code>…, the base of the natural logarithm).</dd>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e not E is symbol for Euler's constant. It wouldn't matter, except that using E for base10 exponential is desirable IMO.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS My be mentioned in a few other cases too.

Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job.

Summarizing the other comments, IMO OK as is, but slightly better if:

  • Use E for base 10 exponentials - e.g. 1.2E56.
  • Use 1st, 2nd, etc when referring to JavaScript editions.

@wbamberg
Copy link
Collaborator Author

Thanks for the review @hamishwillee ! I agree about the "1st" thing, and I've updated to use E notation as well, though
I'm pretty much neutral on that. I am a bit mathematically challenged though.

Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, looks good to me. I've approved so you can self merge if you like, or wait for @sideshowbarker to also have a go.

Copy link
Member

@sideshowbarker sideshowbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful

@wbamberg
Copy link
Collaborator Author

Thanks both for your sharp eyes!

@wbamberg wbamberg merged commit ad09d9d into mdn:main May 21, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2022
@wbamberg wbamberg deleted the remove-sup-javascript branch October 15, 2022 17:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants