Tag: r

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
63 votes
23 answers
2.8K views
Get first key in a (possibly) associative array?

What's the best way to determine the first key in a possibly associative array? My first thought it to ju

avatar
Thurman
0 1 0 9
asked 07 September, 2021
67 votes
30 answers
2K views
How do I convert a string to a number in PHP?

I want to convert these types of values, '3', '2.34', '0.234343', etc. to a numb

avatar
Corrin
0 1 0 9
asked 07 September, 2021
55 votes
11 answers
1.3K views
57 votes
30 answers
2.7K views
How to check if PHP array is associative or sequential?

PHP treats all arrays as associative, so there aren't any built in functions. Can anyone recommend a fair

avatar
Gigi
0 1 0 9
asked 07 September, 2021
59 votes
4 answers
1.7K views
What is thread safe or non-thread safe in PHP?

I saw different binaries for PHP, like non-thread or thread safe? What does this mean? What is the differen

avatar
Basil
0 1 0 9
asked 07 September, 2021
59 votes
7 answers
2.3K views
What is the difference between single-quoted and double-quoted strings in PHP?

I'm a little confused why I see some code in PHP with string placed in single quotes and sometimes in dou

avatar
Jeff
0 1 0 9
asked 07 September, 2021
64 votes
30 answers
2.5K views
Convert a PHP object to an associative array

I'm integrating an API to my website which works with data stored in objects while my code is written usi

avatar
Jeff
0 1 0 9
asked 07 September, 2021
52 votes
27 answers
775 views
Remove empty array elements

Some elements in my array are empty strings based on what the user has submitted. I need to remove those eleme

avatar
Lynette
0 1 0 9
asked 07 September, 2021
52 votes
30 answers
585 views
PHP random string generator

I'm trying to create a randomized string in PHP, and I get absolutely no output with this: <?php

avatar
Janella
0 1 0 9
asked 07 September, 2021
54 votes
10 answers
1.7K views
How can I do &apos;insert if not exists&apos; in MySQL?

I started by googling and found the article How to write INSERT if NOT EXISTS queries in standard SQL which ta

avatar
Bryan
0 1 0 9
asked 07 September, 2021
53 votes
28 answers
393 views
Get the full URL in PHP

avatar
Sachiko
0 1 0 9
asked 07 September, 2021