Skip to content

Commit

Permalink
Updated Syntax (mdn#17669)
Browse files Browse the repository at this point in the history
* Updated Syntax

* Update variables

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated Syntax

* Removed syntax section

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated Syntax

* Updated syntax

* Updated Syntax

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/web/api/paymentrequestevent/modifiers/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated Syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated Syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/web/api/networkinformation/downlinkmax/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Updated syntax

Co-authored-by: Jean-Yves Perrier <[email protected]>

Co-authored-by: Jean-Yves Perrier <[email protected]>
  • Loading branch information
PrajwalBorkar and teoli2003 authored Jun 27, 2022
1 parent 99cd4b7 commit fe82fcf
Show file tree
Hide file tree
Showing 63 changed files with 152 additions and 193 deletions.
5 changes: 2 additions & 3 deletions files/en-us/web/api/network_information_api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ The interface consists of a single {{domxref("NetworkInformation")}} object, an
This example watches for changes to the user's connection.

```js
var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
var type = connection.effectiveType;
let type = navigator.connection.effectiveType;

function updateConnectionStatus() {
console.log("Connection type changed from " + type + " to " + connection.effectiveType);
type = connection.effectiveType;
type = navigation.connection.effectiveType;
}

connection.addEventListener('change', updateConnectionStatus);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ A generic {{domxref("Event")}}.

```js
// Get the connection type.
var type = navigator.connection.type;
const type = navigator.connection.type;

function changeHandler(e) {
// Handle change of connection type here.
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/networkinformation/downlinkmax/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ logs changes as they occur.

```js
function logConnectionType() {
var connectionType = 'not supported';
var downlinkMax = 'not supported';
let connectionType = 'not supported';
let downlinkMax = 'not supported';

if ('connection' in navigator) {
connectionType = navigator.connection.effectiveType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@ The **`effectiveType`** read-only property of the
meaning one of 'slow-2g', '2g', '3g', or '4g'. This value is determined using a
combination of recently observed, round-trip time and downlink values.

## Syntax

```js
var effectiveType = NetworkInformation.effectiveType
```

### Value
## Value

A {{jsxref("String")}} containing one of 'slow-2g', '2g', '3g', or '4g'.

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/nodeiterator/detach/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ None ({{jsxref("undefined")}}).
## Examples

```js
var nodeIterator = document.createNodeIterator(
const nodeIterator = document.createNodeIterator(
document.body,
NodeFilter.SHOW_ELEMENT,
{ acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } }
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/nodeiterator/nextnode/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ None ({{jsxref("undefined")}}).
## Examples

```js
var nodeIterator = document.createNodeIterator(
const nodeIterator = document.createNodeIterator(
document.body,
NodeFilter.SHOW_ELEMENT,
{ acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ A boolean.
## Examples

```js
var nodeIterator = document.createNodeIterator(
const nodeIterator = document.createNodeIterator(
document.body,
NodeFilter.SHOW_ELEMENT,
{ acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } }
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/nodeiterator/previousnode/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ None ({{jsxref("undefined")}}).
## Examples

```js
var nodeIterator = document.createNodeIterator(
const nodeIterator = document.createNodeIterator(
document.body,
NodeFilter.SHOW_ELEMENT,
{ acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } }
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/nodeiterator/referencenode/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ A {{domxref("Node")}}.
## Examples

```js
var nodeIterator = document.createNodeIterator(
const nodeIterator = document.createNodeIterator(
document.body,
NodeFilter.SHOW_ELEMENT,
{ acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } }
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/nodeiterator/root/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ A {{DOMxref("Node")}}.
## Examples

```js
var nodeIterator = document.createNodeIterator(
const nodeIterator = document.createNodeIterator(
document.body,
NodeFilter.SHOW_ELEMENT,
{ acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } }
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/nodeiterator/whattoshow/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ The values that can be combined to form the bitmask are:
## Examples

```js
var nodeIterator = document.createNodeIterator(
const nodeIterator = document.createNodeIterator(
document.body,
( NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT ),
{ acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } }
Expand Down
12 changes: 6 additions & 6 deletions files/en-us/web/api/nodelist/entries/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ Returns an {{jsxref("Iteration_protocols","iterator")}}.
## Example

```js
var node = document.createElement("div");
var kid1 = document.createElement("p");
var kid2 = document.createTextNode("hey");
var kid3 = document.createElement("span");
const node = document.createElement("div");
const kid1 = document.createElement("p");
const kid2 = document.createTextNode("hey");
const kid3 = document.createElement("span");
node.appendChild(kid1);
node.appendChild(kid2);
node.appendChild(kid3);

var list = node.childNodes;
const list = node.childNodes;

// Using for..of
for(var entry of list.entries()) {
for(const entry of list.entries()) {
console.log(entry);
}
```
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/nodelist/foreach/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ node.appendChild(kid1);
node.appendChild(kid2);
node.appendChild(kid3);

let list = node.childNodes;
const list = node.childNodes;

list.forEach(
function(currentValue, currentIndex, listObj) {
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/nodelist/item/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ The `index`th node in the `nodeList` returned by the `item` method.
## Examples

```js
var tables = document.getElementsByTagName("table");
var firstTable = tables.item(1); // or tables[1] - returns the second table in the DOM
const tables = document.getElementsByTagName("table");
const firstTable = tables.item(1); // or tables[1] - returns the second table in the DOM
```

## Specifications
Expand Down
12 changes: 6 additions & 6 deletions files/en-us/web/api/nodelist/keys/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ Returns an {{jsxref("Iteration_protocols","iterator")}}.
## Example

```js
var node = document.createElement("div");
var kid1 = document.createElement("p");
var kid2 = document.createTextNode("hey");
var kid3 = document.createElement("span");
const node = document.createElement("div");
const kid1 = document.createElement("p");
const kid2 = document.createTextNode("hey");
const kid3 = document.createElement("span");

node.appendChild(kid1);
node.appendChild(kid2);
node.appendChild(kid3);

var list = node.childNodes;
let list = node.childNodes;

// Using for..of
for(var key of list.keys()) {
for(const key of list.keys()) {
console.log(key);
}
```
Expand Down
12 changes: 6 additions & 6 deletions files/en-us/web/api/nodelist/values/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ Returns an {{jsxref("Iteration_protocols","iterator")}}.
## Example

```js
var node = document.createElement("div");
var kid1 = document.createElement("p");
var kid2 = document.createTextNode("hey");
var kid3 = document.createElement("span");
const node = document.createElement("div");
const kid1 = document.createElement("p");
const kid2 = document.createTextNode("hey");
const kid3 = document.createElement("span");

node.appendChild(kid1);
node.appendChild(kid2);
node.appendChild(kid3);

var list = node.childNodes;
const list = node.childNodes;

// Using for..of
for(var value of list.values()) {
for(const value of list.values()) {
console.log(value);
}
```
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/notification/body/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ A string.

```js
function spawnNotification(theBody, theIcon, theTitle) {
var options = {
const options = {
body: theBody,
icon: theIcon
}
var n = new Notification(theTitle, options);
const n = new Notification(theTitle, options);

console.log(n.body);
}
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/notification/close/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ notification when the relevant content has been read on the webpage.

```js
function spawnNotification(theBody, theIcon, theTitle) {
var options = {
const options = {
body: theBody,
icon: theIcon
};

var n = new Notification(theTitle,options);
const n = new Notification(theTitle, options);
document.addEventListener('visibilitychange', function() {
if (document.visibilityState === 'visible') {
// The tab has become visible so clear the now-stale Notification.
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/notification/data/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ created, then the notification is fired using the `Notification()`
constructor.

```js
var options = {
const options = {
body: 'Do you like my body?',
data: 'I like peas.'
}

var n = new Notification('Test notification',options);
const n = new Notification('Test notification',options);

console.log(n.data) // should return 'I like peas.'
```
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/notification/dir/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ A string specifying the text direction. Possible values are:
The following snippet fires a notification; a simple `options` object is created, then the notification is fired using the `Notification()` constructor.

```js
var options = {
const options = {
body: 'Do you like my body?',
dir: 'rtl'
}

var n = new Notification('Test notification',options);
const n = new Notification('Test notification',options);

console.log(n.dir) // should return 'rtl'
```
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/notification/icon/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ constructor to fire a notification, passing it arguments to specify the body, ic
title we want.

```js
var notification = new Notification('To do list', {
const notification = new Notification('To do list', {
body: text,
icon: img
});
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/notification/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ function notifyMe() {
// Let's check whether notification permissions have already been granted
else if (Notification.permission === "granted") {
// If it's okay let's create a notification
var notification = new Notification("Hi there!");
let notification = new Notification("Hi there!");
}

// Otherwise, we need to ask the user for permission
else if (Notification.permission !== "denied") {
Notification.requestPermission().then(function (permission) {
// If the user accepts, let's create a notification
if (permission === "granted") {
var notification = new Notification("Hi there!");
let notification = new Notification("Hi there!");
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/notification/lang/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ created, then the notification is fired using the `Notification()`
constructor.

```js
var options = {
const options = {
body: 'Do you like my body?',
lang: 'en-US'
}

var n = new Notification('Test notification',options);
const n = new Notification('Test notification',options);

console.log(n.lang) // should return 'en-US'
```
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/notification/notification/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ the `Notification()` constructor.

```js
function spawnNotification(body, icon, title) {
var options = {
const options = {
body: body,
icon: icon
}
var notification = new Notification(title, options);
const notification = new Notification(title, options);
}
```

Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/notification/permission/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ function notifyMe() {
// Let's check whether notification permissions have already been granted
else if (Notification.permission === "granted") {
// If it's okay let's create a notification
var notification = new Notification("Hi there!");
let notification = new Notification("Hi there!");
}

// Otherwise, we need to ask the user for permission
else if (Notification.permission !== 'denied' || Notification.permission === "default") {
Notification.requestPermission(function (permission) {
// If the user accepts, let's create a notification
if (permission === "granted") {
var notification = new Notification("Hi there!");
let notification = new Notification("Hi there!");
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/notification/requestpermission/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ function notifyMe() {
// Let's check whether notification permissions have already been granted
else if (Notification.permission === "granted") {
// If it's okay let's create a notification
var notification = new Notification("Hi there!");
const notification = new Notification("Hi there!");
}

// Otherwise, we need to ask the user for permission
else if (Notification.permission !== "denied") {
Notification.requestPermission().then(function (permission) {
// If the user accepts, let's create a notification
if (permission === "granted") {
var notification = new Notification("Hi there!");
const notification = new Notification("Hi there!");
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/notification/silent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ The following snippet is intended to fire a silent notification; a simple
{{DOMxRef("Notification.Notification","Notification()")}} constructor.

```js
var options = {
const options = {
body: 'Do you like my body?',
silent: true
}

var n = new Notification('Test notification', options);
const n = new Notification('Test notification', options);

console.log(n.silent) // should log true
```
Expand Down
6 changes: 3 additions & 3 deletions files/en-us/web/api/notification/timestamp/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ created, then the notification is fired using the `Notification()`
constructor.

```js
var dts = Math.floor(Date.now());
const dts = Math.floor(Date.now());

var options = {
const options = {
body: 'Do you like my body?',
timestamp: dts
}

var n = new Notification('Test notification',options);
const n = new Notification('Test notification',options);

console.log(n.timestamp) // should log original timestamp
```
Expand Down
Loading

0 comments on commit fe82fcf

Please sign in to comment.