Java Script

JavaScript (not to be confused with Java) is a high-level, dynamic, multi-paradigm, weakly-typed language used for both client-side and server-side scripting. Its primary use is in rendering and allowing manipulation of web pages. Use this tag for questions regarding ECMAScript and its various dialects/implementations (excluding ActionScript and Google-Apps-Script).

64 votes
30 answers
744 views
How do I include a JavaScript file in another JavaScript file?

Is there something in JavaScript similar to @import in CSS that allows you to include a JavaScript file inside

avatar
Margo
0 1 0 9
asked 07 September, 2021
61 votes
30 answers
776 views
How to return the response from an asynchronous call

I have a function foo which makes an asynchronous request. How can I return the response/result from foo? I am

avatar
Lawanda
0 1 0 9
asked 07 September, 2021
49 votes
30 answers
874 views
How do I remove a property from a JavaScript object?

Say I create an object as follows: let myObject = { "ircEvent": "PRIVMSG", "method": "newURI", "regex":

avatar
Trudy
0 1 0 9
asked 07 September, 2021
58 votes
30 answers
1.4K views
var functionName = function() {} vs function functionName() {}

I've recently started maintaining someone else's JavaScript code. I'm fixing bugs, adding featu

avatar
Arline
0 1 0 9
asked 07 September, 2021
62 votes
30 answers
1.9K views
54 votes
30 answers
2.8K views
57 votes
29 answers
1.2K views
What does "use strict" do in JavaScript, and what is the reasoning behind it?

Recently, I ran some of my JavaScript code through Crockford's JSLint, and it gave the following error:

avatar
Ali
0 1 0 9
asked 07 September, 2021
56 votes
30 answers
2.5K views
How do I check if an element is hidden in jQuery?

Is it possible to toggle the visibility of an element, using the functions .hide(), .show() or .toggle()? How

avatar
Vi
0 1 0 9
asked 07 September, 2021
54 votes
30 answers
2.5K views
How can I remove a specific item from an array?

I have an array of numbers and I'm using the .push() method to add elements to it. Is there a simple way

avatar
Luis
0 1 0 9
asked 07 September, 2021