Skip to content

Commit

Permalink
Fix syntax errors (#28165)
Browse files Browse the repository at this point in the history
  • Loading branch information
OnkarRuikar committed Jul 25, 2023
1 parent d6a3193 commit 9894531
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 20 deletions.
5 changes: 2 additions & 3 deletions files/en-us/learn/server-side/express_nodejs/routes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,10 @@ exports.get("/about", async function (req, res, next) {
try {
const successfulResult = await About.find({}).exec();
res.render("about_view", { title: "About", list: successfulResult });
}
catch (error) {
} catch (error) {
return next(error);
}
};
});
```

That's quite a lot of boilerplate code to add to every function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The following example collects event duration for all events corresponding to an

```js
// The key is the interaction ID.
let = eventLatencies = {};
let eventLatencies = {};

const observer = new PerformanceObserver((list) => {
list.getEntries().forEach((entry) => {
Expand All @@ -44,15 +44,16 @@ const observer = new PerformanceObserver((list) => {
if (!eventLatencies.has(interactionId)) {
eventLatencies[interactionId] = [];
}
eventLatencies[interactionId].push(entry.duration);
eventLatencies[interactionId].push(entry.duration);
}
});
});

observer.observe({type: "event", buffered: true});
observer.observe({ type: "event", buffered: true });

// Log events with maximum event duration for a user interaction
Object.entries(eventLatencies).forEach(([k, v]) => {
console.log(Math.max(...v));
console.log(Math.max(...v));
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ A {{jsxref("Map", "map")}}, with each entry being an extensions' identifier stri
const publicKey = {
// Here are the extension "inputs"
extensions: {
appid: "https://accounts.example.com"
appid: "https://accounts.example.com",
},
allowCredentials: {
id: "fgrt46jfgd...",
transports: ["usb", "nfc"]
type: "public-key"
transports: ["usb", "nfc"],
type: "public-key",
},
challenge: new Uint8Array(16) /* from the server */
challenge: new Uint8Array(16) /* from the server */,
};

navigator.credentials
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/request/signal/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ An {{DOMxRef("AbortSignal")}} object.
const controller = new AbortController();

// Create a request with this controller's AbortSignal object
const req = new Request('/', { signal: controller.signal });
const req = new Request("/", { signal: controller.signal });

// Add an event handler logging a message in case of abort
req.signal.addEventListener("abort", () => {
Expand All @@ -39,7 +39,7 @@ fetch(req).catch(() => {
} else {
console.log("Request not aborted, but terminated abnormally.");
}
};
});

// Actually abort the request
controller.abort();
Expand Down
9 changes: 5 additions & 4 deletions files/en-us/web/api/rtcsctptransport/maxmessagesize/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ const peerConnection = new RTCPeerConnection(options);
const channel = peerConnection.createDataChannel("chat");
channel.onopen = (event) => {
const maximumMessageSize = peerConnection.sctp.maxMessageSize;
const textToSend = "This is my possibly overly long string!"
splitStringToMax(textToSend,maximumMessageSize).forEach( (elem) => {
channel.send(elem);
});
const textToSend = "This is my possibly overly long string!";
splitStringToMax(textToSend, maximumMessageSize).forEach((elem) => {
channel.send(elem);
});
};
```

## Specifications
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async function setUpBidirectional() {
// stream.writable is a WritableStream
const writable = stream.writable;

...
// ...
}
```

Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/media/autoplay_guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ if (navigator.getAutoplayPolicy("mediaelement") === "allowed") {
} else if (navigator.getAutoplayPolicy("mediaelement") === "allowed-muted") {
// Mute audio on video
video.muted = true;
} else (navigator.getAutoplayPolicy("mediaelement") === "disallowed") {
} else if (navigator.getAutoplayPolicy("mediaelement") === "disallowed") {
// Set a default placeholder image.
video.poster = "http://example.com/poster_image_url";
}
Expand All @@ -105,7 +105,7 @@ if (navigator.getAutoplayPolicy(video) === "allowed") {
} else if (navigator.getAutoplayPolicy(video) === "allowed-muted") {
// Mute audio on video
video.muted = true;
} else (navigator.getAutoplayPolicy(video) === "disallowed") {
} else if (navigator.getAutoplayPolicy(video) === "disallowed") {
// Set a default placeholder image.
video.poster = "http://example.com/poster_image_url";
}
Expand Down

0 comments on commit 9894531

Please sign in to comment.