Tag: javascript

60 votes
30 answers
1.4K views
How do I check whether a checkbox is checked in jQuery?

I need to check the checked property of a checkbox and perform an action based on the checked property using j

avatar
Charis
0 1 0 9
asked 07 September, 2021
54 votes
30 answers
2.6K views
How to replace all occurrences of a string in JavaScript

I have this string in my JavaScript code: "Test abc test test abc test test test abc test test abc" Doing: st

avatar
Santiago
0 1 0 9
asked 07 September, 2021
56 votes
30 answers
2.7K views
How to validate an email address in JavaScript

Is there a regular expression to verify an email address in JavaScript?

avatar
Leonardo
0 1 0 9
asked 07 September, 2021
60 votes
30 answers
956 views
For-each over an array in JavaScript

How can I loop through all the entries in an array using JavaScript? I thought it was something like this: f

avatar
Cortez
0 1 0 9
asked 07 September, 2021
60 votes
30 answers
1.8K views
57 votes
30 answers
1K views
What's the difference between using "let" and "var"?

ECMAScript 6 introduced the let statement. I've heard that it's described as a local variable, but I

avatar
Basil
0 1 0 9
asked 07 September, 2021
64 votes
30 answers
745 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
778 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
875 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
59 votes
8 answers
1.8K views
How to make ng-bind-html compile angularjs code

I am working with angularjs 1.2.0-rc.3. I'd like to include html code into a template dynamically. For th

avatar
Benton
0 1 0 9
asked 07 September, 2021
61 votes
6 answers
2.8K views
How to delete/remove nodes on Firebase

I'm using Firebase for a web app. It's written in plain Javascript using no external libraries. I c

avatar
Margo
0 1 0 9
asked 07 September, 2021
62 votes
9 answers
2.2K views
Cannot read property 'push' of undefined when combining arrays

When pushing an array's contents to another array I get "Uncaught TypeError: Cannot read property &a

avatar
Mikki
0 1 0 9
asked 07 September, 2021