[Solved] SyntaxError: Cannot use import statement outside a module

Verify that you have the latest version of Node.js installed (or, at least 13.2.0+). Then do one of the following, as described in the documentation: Option 1 In the nearest parent package.json file, add the top-level “type” field with a value of “module”. This will ensure that all .js and .mjs files are interpreted as … Read more

[Solved] Get the word, from a sentence that the user is talking about [closed]

Credit: ThuverX let word if(content.indexOf(“what”) !== -1 && content[content.indexOf(“what”)+1] !== “is”) word = content[content.indexOf(“what”)+1] else if(content.indexOf(“meaning”) !== -1) word = content[content.indexOf(“meaning”)+2] else if(content.indexOf(“means”) !== -1) word = content[content.indexOf(“means”)-1] 0 solved Get the word, from a sentence that the user is talking about [closed]

[Solved] Get started with Node.js in Windows [closed]

All you have to do is download the Windows version: http://www.nodejs.org/download/ Nothing more. You can run it by typing node on the command prompt. It even sets up the path for you. It’s that simple. 3 solved Get started with Node.js in Windows [closed]

[Solved] NODE.JS How do I save JSON data without filling up my storage [closed]

config For this answer we’ll establish a simple config object to store any values – // config.json {“counter”:0} server We will create a simple server using http.createServer. We will use the request method and request URL to look up a handler or respond with 404 when no handler is found – // server.js import { … Read more

[Solved] how do i send a private message to all people who have a certain role? (discord.js) [closed]

You can use the Role.members property. // get role by name const role = message.guild.roles.cache.find(role => role.name === ‘<roleName>’); // send a message to everyone with the role role.members.each(user => user.send(‘This is a DM’)); This method assumes you have a way to get the <roleName> value from a string; perhaps with an args variable. solved … Read more

[Solved] Setting NodeJS path in Windows XP for SublimeLinter Framework

Prevent node from running and installing on Windows Vista or earlier. Windows XP and Vista are no longer supported Launching the msi, with Windows Installer 5.0 (it’s available as an update) Launching the msi, with Windows Installer < 5.0 What about Node.js v0.10 and v0.12? If you’re still currently using Node.js v0.10 or v0.12, it … Read more

[Solved] Click a button in two pages at once

Out of Curiosity i just tried MartinWebb’s answer. I hope it might give you a start. Page # 1: <button type=”button” onclick=”hello()”>Hello</button> <script type=”text/javascript”> // window.localStorage.removeItem(“text”); function hello() { window.localStorage.setItem(“text”,”Hello there..”); } </script> Page # 2: <p id=”show”></p> <script type=”text/javascript”> window.addEventListener(‘storage’, storage_event_listener, false); function storage_event_listener(evt) { document.getElementById(“show”).innerText = evt.newValue; // console.log(evt); } </script> You can … Read more

[Solved] javascript finding a string in a string

I don’t know Node.js but in javascript it can be done using split() var content = “Hello \n bob \n ben je op deze \n world \n bobert”, content_array = content.split(“\n”); content_array.forEach(function(entry) { document.write(“<content>’+entry+'</content><br />”); }); 1 solved javascript finding a string in a string

[Solved] Regex for finding the second occurrence of a character in a dynamic string in javascript

const regex = /(.*?&.*?)&.*/; const str = `https://www.bing.com/search?q=something+something+something+something&mkt=en-IN&organic=True&ads=False&snippet=False`; const result = str.replace(regex, ‘$1’); The regular expression searches everything before the second “&” and replaces the original string with this match. solved Regex for finding the second occurrence of a character in a dynamic string in javascript