Tag: c

59 votes
8 answers
1.8K views
Why does Google prepend while(1); to their JSON responses?

Why does Google prepend while(1); to their (private) JSON responses? For example, here's a response whil

avatar
Shantay
0 1 0 9
asked 07 September, 2021
55 votes
30 answers
2.5K views
How do I make the first letter of a string uppercase in JavaScript?

How do I make the first letter of a string uppercase, but not change the case of any of the other letters? For

avatar
Jefferey
0 1 0 9
asked 07 September, 2021
61 votes
30 answers
1.8K views
Setting "checked" for a checkbox with jQuery

I'd like to do something like this to tick a checkbox using jQuery: $(".myCheckBox").checked(true); or

avatar
Wilfredo
0 1 0 9
asked 07 September, 2021
56 votes
30 answers
459 views
How do you get a timestamp in JavaScript?

Something similar to Unix's timestamp, that is a single number that represents the current time and date.

avatar
Arline
0 1 0 9
asked 07 September, 2021
48 votes
30 answers
2K views
How do I check if an array includes a value in JavaScript?

What is the most concise and efficient way to find out if a JavaScript array contains a value? This is the onl

avatar
Omar
0 1 0 9
asked 07 September, 2021
61 votes
30 answers
1.7K views
How to create a GUID / UUID

I'm trying to create globally-unique identifiers in JavaScript. I'm not sure what routines are avai

avatar
Lynette
0 1 0 9
asked 07 September, 2021
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
955 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
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