From 165a3c33d98ec8bd286abda2990dd120fdffbf8e Mon Sep 17 00:00:00 2001 From: OnkarRuikar <87750369+OnkarRuikar@users.noreply.github.com> Date: Tue, 25 Jul 2023 12:24:49 +0530 Subject: [PATCH] Fix syntax errors --- .../learn/server-side/express_nodejs/routes/index.md | 5 ++--- .../api/performanceeventtiming/interactionid/index.md | 9 +++++---- .../getclientextensionresults/index.md | 8 ++++---- files/en-us/web/api/request/signal/index.md | 4 ++-- .../web/api/rtcsctptransport/maxmessagesize/index.md | 9 +++++---- .../api/webtransport/createbidirectionalstream/index.md | 2 +- files/en-us/web/media/autoplay_guide/index.md | 4 ++-- 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/files/en-us/learn/server-side/express_nodejs/routes/index.md b/files/en-us/learn/server-side/express_nodejs/routes/index.md index fecf3f84c2b8231..c32a4ccd4a935f2 100644 --- a/files/en-us/learn/server-side/express_nodejs/routes/index.md +++ b/files/en-us/learn/server-side/express_nodejs/routes/index.md @@ -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. diff --git a/files/en-us/web/api/performanceeventtiming/interactionid/index.md b/files/en-us/web/api/performanceeventtiming/interactionid/index.md index 029c481b51eb951..9650ff043479472 100644 --- a/files/en-us/web/api/performanceeventtiming/interactionid/index.md +++ b/files/en-us/web/api/performanceeventtiming/interactionid/index.md @@ -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) => { @@ -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)); }); ``` diff --git a/files/en-us/web/api/publickeycredential/getclientextensionresults/index.md b/files/en-us/web/api/publickeycredential/getclientextensionresults/index.md index f872adf9e146c67..610bb3e7c3ee06c 100644 --- a/files/en-us/web/api/publickeycredential/getclientextensionresults/index.md +++ b/files/en-us/web/api/publickeycredential/getclientextensionresults/index.md @@ -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 diff --git a/files/en-us/web/api/request/signal/index.md b/files/en-us/web/api/request/signal/index.md index 62206d7e57667a3..0068e7aadf9d4d8 100644 --- a/files/en-us/web/api/request/signal/index.md +++ b/files/en-us/web/api/request/signal/index.md @@ -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", () => { @@ -39,7 +39,7 @@ fetch(req).catch(() => { } else { console.log("Request not aborted, but terminated abnormally."); } -}; +}); // Actually abort the request controller.abort(); diff --git a/files/en-us/web/api/rtcsctptransport/maxmessagesize/index.md b/files/en-us/web/api/rtcsctptransport/maxmessagesize/index.md index 297c43502250acb..5c8e126b5043ed6 100644 --- a/files/en-us/web/api/rtcsctptransport/maxmessagesize/index.md +++ b/files/en-us/web/api/rtcsctptransport/maxmessagesize/index.md @@ -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 diff --git a/files/en-us/web/api/webtransport/createbidirectionalstream/index.md b/files/en-us/web/api/webtransport/createbidirectionalstream/index.md index 7be6694d66a77d2..7db6c3dde24ef0b 100644 --- a/files/en-us/web/api/webtransport/createbidirectionalstream/index.md +++ b/files/en-us/web/api/webtransport/createbidirectionalstream/index.md @@ -70,7 +70,7 @@ async function setUpBidirectional() { // stream.writable is a WritableStream const writable = stream.writable; - ... + // ... } ``` diff --git a/files/en-us/web/media/autoplay_guide/index.md b/files/en-us/web/media/autoplay_guide/index.md index 525c4168e0800c0..9d6de2bb1f06c0a 100644 --- a/files/en-us/web/media/autoplay_guide/index.md +++ b/files/en-us/web/media/autoplay_guide/index.md @@ -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"; } @@ -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"; }