localhost terminates without an error using Node.JS win arm64

VERSIONS

Windows: 11 (ARM)** (24H2 (OS Build 26100.2314))
Node.JS: v22.11.0 (Windows ARM64)
Next.JS: 14.2.3
React: ^18

package.json:

{
  "name": "wf-quizzes",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "generate-api": "node ./bin/generate-api-specs.mjs"
  },
  "dependencies": {
    "@dnd-kit/core": "^6.1.0",
    "@dnd-kit/sortable": "^8.0.0",
    "@dnd-kit/utilities": "^3.2.2",
    "@headlessui/react": "^2.0.4",
    "@nextui-org/react": "^2.4.8",
    "@nextui-org/system": "^2.2.6",
    "@nextui-org/theme": "^2.2.11",
    "@nextui-org/tooltip": "^2.0.41",
    "@react-hookz/web": "^24.0.4",
    "@react-spring/web": "^9.7.3",
    "@reduxjs/toolkit": "^2.2.6",
    "@types/react-toastify": "^4.0.2",
    "@types/react-window": "^1.8.8",
    "@uiw/react-color": "^2.3.2",
    "ag-grid-react": "^32.1.0",
    "axios": "^1.7.7",
    "buffer": "^6.0.3",
    "clsx": "^2.1.1",
    "d3": "^7.9.0",
    "dnd-kit": "^0.0.2",
    "embla-carousel-react": "^8.1.8",
    "file-saver": "^2.0.5",
    "framer-motion": "^11.2.11",
    "json": "^11.0.0",
    "jwt-decode": "^4.0.0",
    "libphonenumber-js": "^1.11.4",
    "localforage": "^1.10.0",
    "next": "14.2.3",
    "next-auth": "^4.24.7",
    "next-intl": "^3.17.2",
    "next-svgr": "^0.0.2",
    "pako": "^2.1.0",
    "react": "^18",
    "react-audio-visualize": "^1.1.3",
    "react-calendar": "^5.0.0",
    "react-colorful": "^5.6.1",
    "react-dom": "^18",
    "react-redux": "^9.1.2",
    "react-scan": "^0.0.12",
    "react-textarea-autosize": "^8.5.3",
    "react-tinder-card": "^1.6.4",
    "react-toastify": "^10.0.6",
    "react-window": "^1.8.10",
    "redux-persist": "^6.0.0",
    "redux-persist-indexeddb-storage": "^1.0.4",
    "redux-persist-transform-encrypt": "^5.1.1",
    "reselect": "^5.1.1",
    "sass": "^1.77.2",
    "scss": "^0.2.4",
    "swagger-typescript-api": "^13.0.3",
    "tailwindcss": "^3.4.14",
    "tinycolor2": "^1.6.0",
    "uuidv4": "^6.2.13"
  },
  "devDependencies": {
    "@eslint/js": "^9.10.0",
    "@types/file-saver": "^2.0.7",
    "@types/lodash.debounce": "^4.0.9",
    "@types/node": "^20",
    "@types/pako": "^2.0.3",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "@typescript-eslint/eslint-plugin": "^8.5.0",
    "@typescript-eslint/parser": "^8.5.0",
    "eslint": "^8.57.0",
    "eslint-config-next": "^14.2.3",
    "eslint-plugin-react": "^7.36.1",
    "globals": "^15.9.0",
    "typescript": "^5",
    "typescript-eslint": "^8.5.0"
  }
}

PROBLEM

After starting the project and doing some actions on the page, localhost just terminates in a random point of time after random click without any error:

enter image description here

What’s interesting, when I changed NodeJS to x64, then everything began working okay without such drops. At the same time, when I updated one of my projects from Next.JS 14.2.3 to Next.JS 15.0.3, it solved the problem. But unlike the project where it helped, I can’t upgrade my current project due to amount of code conflicts after upgrade.

Also I tried to check if CPU or RAM are overloaded so it could lead to it but no


PLEASE let me know what else I can share here to understand conditions and environment better.

My Javascripting skills are pretty much non-existent. How can I do something like this curl example in a browser with javascript?

The cik should be a variable I would need to increment “from” to allow pagination.

curl -XPOST -H "Content-type: application/json" -d '{
  "query": "cik:<CIK_VALUE_FROM_USER> AND formType:"4"",
  "from": "0",
  "size": "10",
  "sort": [{ "filedAt": { "order": "desc" } }]
}' 'https://api.sec-api.io?token=<MY_CONSTANT_TOKEN_VALUE>'

This is the stupid crap I’ve tried so far. “<>” have replaced the variable and a token I got from the SEC.

<!DOCTYPE html>
<html>
<head>
    <title>Insider Trading</title>
</head>
<body>
<script>
    const userAction = async () => {
        var queryBody = {
            "query": "cik:<CIK_VAR_FROM_USER> AND formType:"4"",
            "from": "0",
            "size": "1",
            "sort": [{ "filedAt": { "order": "desc" } }]
        }
        const response = await fetch('https://api.sec-api.io?token=<MY_TOKEN>', {
            method: 'POST',
            body: queryBody.toString(), // string or object
            headers: {
                'Content-Type': 'application/json'
            }
        });
        const myJson = await response.json(); //extract JSON from the http response
        alert(response.statusText);
    }</script>
<form>
    <button id="form-submit" onclick="userAction()">Submit</button>
    <label>CIK:</label>
        <input type="text" name="cik" placeholder="CIK"></input>
</form>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>

</body>
</html>

Importing functions from several modules into one and then exporting all of them at once

I have many subfolders and files in ../foo that export many functions. I would like to collect all of them in one module and export them all together to be used myModule.ts. The following certainly works but is tedious (we are taking 200+ functions), is there a better way?

// collection.ts
import { a, b, c } from '../foo/bar';
import { d, e, f } from '../foo/baz';
import { x, y, z } from '../foo/qux';

export { a, b, c, d, e, f, x, y, z };
// myModule.ts
import * as FUNCTIONS_LOOKUP_TABLE from './collection';

const myFunc = (index) => FUNCTIONS_LOOKUP_TABLE[index].call(...)

JavaScript 5 star rating script

I need to add the score to the hidden input to be processed with PHP.


JAVASCRIPT

I have added the get elemend by the input id of “score”. I need it to update the hidden field before the page is submitted to the PHP script to add the rating to a database.

It looks like your post is mostly code; please add some more details.It looks like your post is mostly code; please add some more details.It looks like your post is mostly code; please add some more details.It looks like your post is mostly code; please add some more details.It looks like your post is mostly code; please add some more details.It looks like your post is mostly code; please add some more details.It looks like your post is mostly code; please add some more details.It looks like your post is mostly code; please add some more details… XD

// To access the stars
let stars = 
    document.getElementsByClassName("star");
let output = 
    document.getElementById("output");
let score = 
    document.getElementById("score");
 
// Funtion to update rating
function gfg(n) {
    remove();
    for (let i = 0; i < n; i++) {
        if (n == 1) cls = "one";
        else if (n == 2) cls = "two";
        else if (n == 3) cls = "three";
        else if (n == 4) cls = "four";
        else if (n == 5) cls = "five";
        stars[i].className = "star " + cls;
    }
    output.innerText = "Rating is: " + n + "/5";
    score.innerText = n;
    
}
 
// To remove the pre-applied styling
function remove() {
    let i = 0;
    while (i < 5) {
        stars[i].className = "star";
        i++;
    }
}

HTML

Here we have the HTML.

<!-- index.html -->
 
<!DOCTYPE html>
<html>
 
<head>
    <meta charset="utf-8" />
    <title>Star Rating</title>
    <meta name="viewport"
          content="width=device-width, 
                   initial-scale=1" />
    <link rel="stylesheet"
          href="styles.css" />
</head>
 
<body>
    <div class="card">
        <h1>JavaScript Star Rating</h1>
        <br />
        <span onclick="gfg(1)"
              class="star">★
        </span>
        <span onclick="gfg(2)"
              class="star">★
        </span>
        <span onclick="gfg(3)"
              class="star">★
        </span>
        <span onclick="gfg(4)"
              class="star">★
        </span>
        <span onclick="gfg(5)"
              class="star">★
        </span>
        <h3 id="output">
              Rating is: 0/5
          </h3>
    </div>

    <input id="score" type="hidden" name="score" value="">

    <script src="script.js"></script>
</body>
 
</html>

CSS

And the CSS.

/* style.css */
 
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
 
body {
  min-height: 50vh;
  display: flex;
  align-items: center;
  text-align: center;
  justify-content: center;
  background: hsl(137, 46%, 24%);
  font-family: "Poppins", sans-serif;
}
 
.card {
  max-width: 33rem;
  background: #fff;
  margin: 0 1rem;
  padding: 1rem;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
  width: 100%;
  border-radius: 0.5rem;
}
 
.star {
  font-size: 10vh;
  cursor: pointer;
}
 
.one {
  color: rgb(255, 0, 0);
}
 
.two {
  color: rgb(255, 106, 0);
}
 
.three {
  color: rgb(251, 255, 120);
}
 
.four {
  color: rgb(255, 255, 0);
}
 
.five {
  color: rgb(24, 159, 14);
}

Why is the Authorization not working with the external API?

I am connecting my website with a delivery service, and while requesting the pickup location API, it stops working and shows a 401 error. I checked the token and confirmed the response is coming when requesting from Postman, but it’s not working in the browser. Is there something wrong with my code or approach?

try {
        const headers = {
            'Authorization': `Bearer ${token}`,
            'Content-Type': 'application/json'
        };

        // Make the request
        const res = await fetch('https://apiv2.shiprocket.in/v1/external/settings/company/pickup', {
            headers
        });
        console.log("res", res)
        if (res.ok) {
            const data = await res.json()
            console.log("data", data)
            address = data.data.shipping_address
        }
    } catch (err) {
        console.log(err)
        address = undefined
    }

Initialise the date in a date type field

Why does ‘jj – mm – aaaa’ appear in the ‘From’ input field instead of the date of the last Sunday (see line 50 in included source) after selecting ‘Voting period’ in the drop-down menu ?

However, this field displays correctly ‘9999’ or the (today’s) desired date after selecting ‘Question nr’ resp. ‘Creation date’ in this drop-down menu, as well as the number ‘1’ or the correct dates in the ‘To’ field !?

Why is the ‘formattedLastSunday’ constant not accepted as From.value on line 50 (Javascript) ?


<!DOCTYPE html>

<?php
    if (!isset($_GET["select"]) OR $_GET["select"] == "") $select = "1"; else $select = $_GET["select"];        //  echo "===".$select."===";
    if (!isset($_GET["From"  ]) OR $_GET["From"  ] == "") {if ($select == "1") $From = "9999"; else $From = "2024-01-01" ;} else $From = $_GET["From"];     //  echo "===".$From."===";
    if (!isset($_GET["To"    ]) OR $_GET["To"    ] == "") {if ($select == "1") $To   = "1"   ; else $To   = "2024-01-01" ;} else $To   = $_GET["To"  ];     //  echo "===".$To."===";
    echo "[ Sent by form to the server (php) : ===".$select."===".$From."===".$To."=== ]";
?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta charset="utf-8" http-equiv="content-type" content="text/html" />
        <title>Test_03</title>
        <script>
            function btnInset(p1) {
            //  alert("--"+p1+"--"+p2+"--"+p3+"--");
                var btn = document.getElementById('btn'+p1)
                btn.classList.replace("btnOutset", "btnInset");
            //  document.forms[0].elements['btn_'].value = p1;
            }

            function chgSelect(p) {
            //  alert ('Change to option '+p+' !');
                
                var From = document.getElementById('From');
                if (p == 1) {
                    From.setAttribute('type', 'text');
                    From.setAttribute('size', '4');
                    From.value = 9999;
                } else if (p == 2) {
                    From.setAttribute('type', 'date');
                    From.setAttribute('size', '8');
                    var today = new Date();
                    From.valueAsDate = today;
                } else {        // (p = 3)
                    From.setAttribute('type', 'date');
                    From.setAttribute('size', '8');
                    var now = new Date();
                    var today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
                    var lastSunday = new Date(today.setDate(today.getDate() - today.getDay()));
                    const yyyy = lastSunday.getFullYear();
                    let mm = lastSunday.getMonth() + 1;     // Months start at 0!
                    let dd = lastSunday.getDate();
                    if (dd < 10) dd = '0' + dd;
                    if (mm < 10) mm = '0' + mm;
            //      const formattedLastSunday = '"' + yyyy + '-' + mm + '-' + dd + '"';
                    const formattedLastSunday = '"' + dd + '-' + mm + '-' + yyyy + '"';
            //      alert(formattedLastSunday);             // OK !
                    From.value = formattedLastSunday;       // KO ! Why ?
            //      From.value = '"' + yyyy + '-' + mm + '-' + dd + '"';
                }
                
                var To = document.getElementById('To');
                if (p == 1) {
                    To.setAttribute('type', 'text');
                    To.setAttribute('size', '4');
                    To.value = 1;
                } else if (p == 2) {
                    To.setAttribute('type', 'date');
                    To.setAttribute('size', '8');
                    To.value = "2024-01-02";
                } else {        // (p = 3)
                    To.setAttribute('type', 'date');
                    To.setAttribute('size', '8');
                    To.value = "2024-01-04";
                }
            }
        </script>
    </head>
    
    <body style="text-align: center;">
        <h1> &nbsp; </h1>
        <form action="">
            <label for="select"> Select and sort by </label>
            <select name="select" id="select" onChange="chgSelect(value);">
                <option value="1" <?php if($select == 1) echo "selected" ?>> Question nr </option>
                <option value="2" <?php if($select == 2) echo "selected" ?>> Creation date </option>
                <option value="3" <?php if($select == 3) echo "selected" ?>> Voting period </option>
            </select> &nbsp;
            <label for="From"> : &nbsp; From </label>
            <input name="From" id="From" type="<?php if($select == 1) echo "text"; else echo "date"; ?>" style="text-align: center;" size="4" value="<?php echo $From ?>"/> &nbsp;
            <label for="To"> To </label>
            <input name="To" id="To" type="<?php if($select == 1) echo "text"; else echo "date"; ?>" style="text-align: center;" size="4" value="<?php echo $To ?>"/> &nbsp;
            <button id="btn1" type="submit" class="btnOutset" onclick="btnInset(1);"> Submit </button>
        </form>
    </body>
</html>

Initialise the date in a date type field, a little more help in a problematic case please

Why does ‘jj – mm – aaaa’ appear in the ‘From’ input field instead of the date of the last Sunday (see line 50 in included source) after selecting ‘Voting period’ in the drop-down menu ?

However, this field displays correctly ‘9999’ or the (today’s) desired date after selecting ‘Question nr’ resp. ‘Creation date’ in this drop-down menu, as well as the number ‘1’ or the correct dates in the ‘To’ field !?

Why is the ‘formattedLastSunday’ constant not accepted as From.value on line 50 (Javascript) ?


<!DOCTYPE html>

<?php
    if (!isset($_GET["select"]) OR $_GET["select"] == "") $select = "1"; else $select = $_GET["select"];        //  echo "===".$select."===";
    if (!isset($_GET["From"  ]) OR $_GET["From"  ] == "") {if ($select == "1") $From = "9999"; else $From = "2024-01-01" ;} else $From = $_GET["From"];     //  echo "===".$From."===";
    if (!isset($_GET["To"    ]) OR $_GET["To"    ] == "") {if ($select == "1") $To   = "1"   ; else $To   = "2024-01-01" ;} else $To   = $_GET["To"  ];     //  echo "===".$To."===";
    echo "[ Sent by form to the server (php) : ===".$select."===".$From."===".$To."=== ]";
?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta charset="utf-8" http-equiv="content-type" content="text/html" />
        <title>Test_03</title>
        <script>
            function btnInset(p1) {
            //  alert("--"+p1+"--"+p2+"--"+p3+"--");
                var btn = document.getElementById('btn'+p1)
                btn.classList.replace("btnOutset", "btnInset");
            //  document.forms[0].elements['btn_'].value = p1;
            }

            function chgSelect(p) {
            //  alert ('Change to option '+p+' !');
                
                var From = document.getElementById('From');
                if (p == 1) {
                    From.setAttribute('type', 'text');
                    From.setAttribute('size', '4');
                    From.value = 9999;
                } else if (p == 2) {
                    From.setAttribute('type', 'date');
                    From.setAttribute('size', '8');
                    var today = new Date();
                    From.valueAsDate = today;
                } else {        // (p = 3)
                    From.setAttribute('type', 'date');
                    From.setAttribute('size', '8');
                    var now = new Date();
                    var today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
                    var lastSunday = new Date(today.setDate(today.getDate() - today.getDay()));
                    const yyyy = lastSunday.getFullYear();
                    let mm = lastSunday.getMonth() + 1;     // Months start at 0!
                    let dd = lastSunday.getDate();
                    if (dd < 10) dd = '0' + dd;
                    if (mm < 10) mm = '0' + mm;
            //      const formattedLastSunday = '"' + yyyy + '-' + mm + '-' + dd + '"';
                    const formattedLastSunday = '"' + dd + '-' + mm + '-' + yyyy + '"';
            //      alert(formattedLastSunday);             // OK !
                    From.value = formattedLastSunday;       // KO ! Why ?
            //      From.value = '"' + yyyy + '-' + mm + '-' + dd + '"';
                }
                
                var To = document.getElementById('To');
                if (p == 1) {
                    To.setAttribute('type', 'text');
                    To.setAttribute('size', '4');
                    To.value = 1;
                } else if (p == 2) {
                    To.setAttribute('type', 'date');
                    To.setAttribute('size', '8');
                    To.value = "2024-01-02";
                } else {        // (p = 3)
                    To.setAttribute('type', 'date');
                    To.setAttribute('size', '8');
                    To.value = "2024-01-04";
                }
            }
        </script>
    </head>
    
    <body style="text-align: center;">
        <h1> &nbsp; </h1>
        <form action="">
            <label for="select"> Select and sort by </label>
            <select name="select" id="select" onChange="chgSelect(value);">
                <option value="1" <?php if($select == 1) echo "selected" ?>> Question nr </option>
                <option value="2" <?php if($select == 2) echo "selected" ?>> Creation date </option>
                <option value="3" <?php if($select == 3) echo "selected" ?>> Voting period </option>
            </select> &nbsp;
            <label for="From"> : &nbsp; From </label>
            <input name="From" id="From" type="<?php if($select == 1) echo "text"; else echo "date"; ?>" style="text-align: center;" size="4" value="<?php echo $From ?>"/> &nbsp;
            <label for="To"> To </label>
            <input name="To" id="To" type="<?php if($select == 1) echo "text"; else echo "date"; ?>" style="text-align: center;" size="4" value="<?php echo $To ?>"/> &nbsp;
            <button id="btn1" type="submit" class="btnOutset" onclick="btnInset(1);"> Submit </button>
        </form>
    </body>
</html>

How can i fix the ‘Undefined variable’ error in my JavaScript code when using a function from another file?

How can i fix the ‘Undefined variable’ error in my JavaScript code when using a function from another file?

I imported the function using import syntax in my main.js file like this:
jscode:

import{myFunction} from'./utils.js;

However,when i call myFunction in main.js,I get the error.

What I expected:
I expected the function to work without error, allowing me to use it in main.js

How to use javascript variables in URL as querystring parameters

I want to use javascript variables in URL as querystring parameters. what is correct way?

 var fromSemester = document.getElementById('<%= newFromSemesterValue.ClientID%>').value;
 var toSemester = document.getElementById('<%= newToSemesterValue.ClientID%>').value;

I wan to use fromSemester and toSemester variables in URL as querystring parameters like below: But javascript throws en error. What is the correct way to use VAR variables inside URL?

var url = 'MyPage.aspx?id=2&fromsemester='fromSemester'&tosemester='toSemester'&language=eng'

But this URL is not working

How to create a loading effect in react image turntable

I am working on this library called react-image-turntable in my project, Now how can i insert a loading effect or progress bar while the images are being loaded? because currently I am only seeing empty page while the images is being loaded.

return (
    <ReactImageTurntable
      images={images}
      autoRotate={{ disabled: rotationDisabled, interval: 200 }}
      onPointerDown={() => setRotationDisabled(true)}
      onPointerUp={() => setRotationDisabled(false)}
      onKeyDown={handleKeyDown}
      onKeyUp={() => setRotationDisabled(false)}
    />
  );

thanks

Hicharts wrapping up data in Angular in production mode

We are trying to plot simple data series in Highcharts the data series is as follows,

[
  {
    "x": 1072828800000,
    "y": 13.916425650742994
  },
  {
    "x": 1104451200000,
    "y": 15.764275012485435
  },
  {
    "x": 1135987200000,
    "y": 16.768132780082986
  },
  {
    "x": 1167523200000,
    "y": 18.008780817291456
  },
  {
    "x": 1199059200000,
    "y": 20.989796268938743
  },
  {
    "x": 1230681600000,
    "y": 22.480956411341516
  },
  {
    "x": 1262217600000,
    "y": 22.209314832741743
  },
  {
    "x": 1293753600000,
    "y": 22.102337923121055
  },
  {
    "x": 1325289600000,
    "y": 23.43494397002126
  },
  {
    "x": 1356912000000,
    "y": 23.921638341747848
  },
  {
    "x": 1388448000000,
    "y": 24.769899200556136
  },
  {
    "x": 1419984000000,
    "y": 25.955515206536543
  },
  {
    "x": 1451520000000,
    "y": 24.956450638131464
  },
  {
    "x": 1483142400000,
    "y": 25.794040661192586
  },
  {
    "x": 1514678400000,
    "y": 27.858886096237207
  },
  {
    "x": 1546214400000,
    "y": 29.8801627148459
  },
  {
    "x": 1577750400000,
    "y": 30.590097977126252
  },
  {
    "x": 1609372800000,
    "y": 30.91773692290411
  },
  {
    "x": 1640908800000,
    "y": 35.06282722513089
  },
  {
    "x": 1672444800000,
    "y": 30.054431472652876
  },
  {
    "x": 1703980800000,
    "y": 33.257303546320884
  }
]

Here are the series options

const hist_placeHolderSeriesOptions: Highcharts.SeriesColumnOptions = {
  id: 'placeHolderSeries',
  name: 'PlaceHolderSeries',
  type: 'column',
  showInNavigator: false,
  enableMouseTracking: true,
  stickyTracking: false,
  animation: true,
  zIndex: 4,
  legendIndex: 1,
  dashStyle: 'Solid',
  color: chartColors.black1,
    };

Highcharts version: 11.4
Angular 17

Unfortunately cannot post the entire chart code because the code is very elaborate,

When I run our angular server as ng serve in dev mode the chart is plotted correctly.
But when I do a production build of the same project without any change some how the first point of data disappears and last data point is wrapped around the first data point.

Here’s what it looks like in each mode.

In development mode:
angular compiled in development mode

In production mode:
angular compiled in production mode

When I try to console log that data series the above data is what I get, so there is no difference in that.

There are few pointers about this problem.

  1. This problem is very consistent and always appears.
  2. If I use range selector shorten the time frame and maximize it the issue disappears.

In HTML and JavaScript, Is there a way to stop scrolling when space is pressed?

I am making a very simple space invaders game, and it uses space to fire. The problem is that when you tap space, as well as fire the projectile, it also scrolls down the page as I have a large canvas. Is there a way to prevent this while still being able to scroll? Keep in mind that I’m a beginner at this so I apologize if I’m just being stupid.

I tried the putting the following code in my css file.

body {
   overflow: 'hidden"
}

this didn’t work because it completely hides everything off-screen. Not just disabling the space bar scrolling

this is my code where the problem still exists

here is the css file

body{
    font-family:'Courier New', Courier, monospace;
    text-align: center;
}
#board {
    border-bottom: 1px solid black;
}

here is the Html file

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport", content="width=device-width, initial-scale=1.0">
        <title>Space Invaders</title>
        <link rel="stylesheet" href="spaceinvaders.css">
        <script src="spaceinvaders.js"></script>
    </head>
    <body>
        <h1>Space Invaders</h1>
        <canvas id="board"></canvas>
        <p>blahblahblahbalhablahjgbksvdbsugbsdgudgudsughusdhdguihsduihg</p>
    </body>
</html>

here is the javascript file

//board
let board;
let boardWidth = 500;
let boardHeight = 600;
let context;

let gameOver = false

//ship
let shipWidth = 75;
let shipHeight = 95;
let shipX = 218;
let shipY = 500;
let shipImg; 
//actual dimentions
//21px from left edge
//24px from right edge
//middle at 45 from left edge
//middle 51 from right edge

//bullet
let bulletArray = [];
let bulletWidth = 75;
let bulletHeight = 95;
let bulletX = 218

//ship varuble
let ship = {
    x : shipX,
    y : shipY,
    width : shipWidth,
    height : shipHeight
}

//physics for ship

let Xspeed = 0;
let moveLeft = false;
let moveRight = false;

//physics for bullet
let bulletSpeed = 2
window.onload = function() { //when game starts 
    board = document.getElementById("board");
    board.height = boardHeight;
    board.width = boardWidth;

    context = board.getContext("2d"); //used for drawing on the board

    //draw initial dinosaur
    // context.fillStyle="green";
    // context.fillRect(dino.x, dino.y, dino.width, dino.height);

    shipImg = new Image();
    shipImg.src = "./spaceinvadersImgs/ship.png";
    shipImg.onload = function() {
        console.log("imgLoaded")
        context.drawImage(shipImg, ship.x, ship.y, ship.width, ship.height);
    }
    bulletImg = new Image();
    bulletImg.src = "./spaceinvadersImgs/bullet.png";

    
    window.addEventListener("keydown", function(e){
        switch(e.key){
            case "ArrowLeft":
                moveLeft = true
                break;
            case "ArrowRight":
                moveRight = true
                break;
            case " ":
                console.log("shoot bullet")
                if (e.key === " "){
            
                    //place bullet
                    let bullet = {
                        img : bulletImg,
                        x : ship.x,
                        y : 536,
                        width : bulletWidth,
                        height: bulletHeight
                    }
                        bulletArray.push(bullet); //add bullet at this moment to the array
            
                    if (bulletArray.length > 25) {
                        bulletArray.shift(); //remove the first element from the array so that the array doesn't constantly grow
                    }
                }

        }
    }, false);
    window.addEventListener("keyup", function(e){
        switch(e.key){
            case "ArrowLeft":
                moveLeft = false
                break;
            case "ArrowRight":
                moveRight = false
                break;
            
        }
    }, false);
    update()
}
function update(){
    requestAnimationFrame(update);
    console.log("update")
    //preping for next frame
    if (gameOver) {
        return;
    }

    if(ship.x < 0 && Xspeed == -5 || ship.x > 500 && Xspeed == 5){
        Xspeed = 0
    }
    ship.x += Xspeed;   

    if(moveLeft && !moveRight){
        Xspeed = -5
    }
    if(moveRight && !moveLeft){
        Xspeed = 5
    }
    if(!moveLeft && !moveRight){
        Xspeed = 0
    }
   

    context.clearRect(0, 0, board.width, board.height);

    for (let i = 0; i < bulletArray.length; i++) {
        let bullet = bulletArray[i];
        bullet.y -= bulletSpeed;
        context.drawImage(bullet.img, bullet.x, bullet.y, bullet.width, bullet.height);
    }
    context.drawImage(shipImg, ship.x, ship.y, ship.width, ship.height);
};

how can i remove the transparency of the scroll bar in monaco editor?

I don’t want the text to be seen behind the scrollbar. Maybe with some margin? I tried this:

 <Editor
    height="100%"
    defaultValue={''}
    theme={mode === 'dark' ? 'vs-dark' : 'light'}
    language="html"
    value={props.value ?? ''}
    onChange={handleChange}
    options={{
      minimap: { enabled: false },
      lineNumbersMinChars: 2,
      readOnly: props.readOnly,
      scrollbar: {
        backgroundColor: mode === 'dark' ? '#333' : '#f0f0f0',  
        sliderBackground: 'rgba(100, 100, 100, 0.5)', 
        activeSliderBackground: 'rgba(150, 150, 150, 0.8)',
      },
      padding: { right:100 },
      margin: { right:100 },
      alwaysConsumeMouseWheel: true,
    }}
    onMount={handleEditorMount}
  />

enter image description here

create a responsive navigation bar with CSS? Example I’m building a coffee shop website and want the navigation to adapt to different screen sizes [closed]

I’m building a coffee shop website and want a navigation bar that adjusts for all screen sizes. On larger screens, links should display horizontally, and on smaller screens, they should collapse into a hamburger menu.

On larger screens, the navigation links should display horizontally.
On smaller screens, the links should collapse into a hamburger menu, and clicking the menu should toggle the links.

How to retrieve html hidden field value in javascript

I populated the hidden field under OnSelectedIndexChanged event:

<asp:DropDownList ID="DropDownToSemester" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownToSemester_SelectedIndexChanged"></asp:DropDownList>

 <input type="hidden" id="newToSemesterValue" runat="server" />




protected void DropDownToSemester_SelectedIndexChanged(object sender, EventArgs e)
 {           
   newToSemesterValue.Value = DropDownToSemester.SelectedValue;
 }

I cannot retrieve the HTML hidden field value in javascript:

<script type="text/javascript">

function test() {

var toSemester = document.getElementById('<%= newToSemesterValue.ClientID%>').value;
}

The variable toSemester returns null.. why is that ??