itemId
stringlengths
1
34
itemType
stringclasses
4 values
site
stringclasses
4 values
scrapedAt
timestamp[s]date
2026-08-03 00:21:25
2026-08-03 04:01:45
tagName
stringlengths
1
34
questionCount
int64
2
2.53M
hasSynonyms
bool
2 classes
isModeratorOnly
bool
1 class
isRequired
bool
1 class
link
stringlengths
32
258
_run_id
stringclasses
57 values
_dataset_id
stringclasses
57 values
questionId
int64
1
80M
title
stringlengths
15
150
score
int64
-10
35.3k
viewCount
int64
6
16.7M
answerCount
int64
0
296
isAnswered
bool
2 classes
hasAcceptedAnswer
bool
2 classes
tags
listlengths
1
6
createdAt
timestamp[s]date
2008-08-01 04:18:04
2026-08-03 03:37:34
lastActivityAt
timestamp[s]date
2008-10-30 09:20:18
2026-08-03 01:36:51
ownerDisplayName
stringlengths
3
30
isClosed
bool
2 classes
contentLicense
stringclasses
3 values
acceptedAnswerId
int64
4
80M
ownerUserId
int64
1
33M
ownerReputation
int64
1
1.53M
userId
int64
13
33M
displayName
stringclasses
897 values
reputation
int64
1
1.53M
userType
stringclasses
3 values
lastAccessAt
timestamp[s]date
2011-01-10 08:55:57
2026-08-03 03:38:13
goldBadges
int64
0
895
silverBadges
int64
0
9.32k
bronzeBadges
int64
0
9.36k
reputationChangeMonth
int64
-40
1.43k
reputationChangeYear
int64
-1,146
11.7k
websiteUrl
stringclasses
302 values
location
stringclasses
279 values
acceptRate
int64
17
100
answerId
int64
1.13k
80M
isAccepted
bool
2 classes
bodyText
stringlengths
31
24.4k
bodyHtml
stringlengths
39
34.9k
answers
listlengths
1
3
answersFetched
int64
0
3
79959134
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79959134/cudaexecutionprovider-fails-to-initialize-insightface-uses-cpu-only
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,959,134
CUDAExecutionProvider fails to initialize, InsightFace uses CPU only
1
113
1
true
false
[ "python", "deep-learning", "onnx" ]
2026-06-15T11:36:37
2026-06-17T09:39:01
Vishavpreet Learner
false
CC BY-SA 4.0
null
32,839,792
19
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79959083
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79959083/when-should-i-use-a-binary-tree-in-python-and-what-problems-does-it-solve
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,959,083
When should I use a Binary Tree in Python, and what problems does it solve?
1
253
11
true
false
[ "python", "binary-tree" ]
2026-06-15T09:24:07
2026-06-16T17:04:23
Py-Learner
false
CC BY-SA 4.0
null
32,085,922
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79959049
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79959049/how-to-remove-an-item-from-a-python-asyncio-queue
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,959,049
How to remove an item from a Python asyncio Queue?
0
180
4
true
false
[ "python", "python-asyncio" ]
2026-06-15T08:07:12
2026-06-16T10:31:18
cookiedealer
false
CC BY-SA 4.0
null
4,989,172
381
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79958966
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79958966/how-to-handle-class-imbalance-in-pytorch-when-using-imagefolder-for-medical-imag
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,958,966
How to handle class imbalance in PyTorch when using ImageFolder for medical image classification?
2
170
2
false
false
[ "python", "pytorch" ]
2026-06-15T03:25:39
2026-07-06T12:29:01
user32838198
false
CC BY-SA 4.0
null
32,838,198
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79958839
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79958839/is-http-error-500-appropriate-when-i-raise-a-valueerror
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,958,839
Is HTTP error 500 appropriate when I raise a ValueError?
-4
158
1
true
false
[ "python", "http" ]
2026-06-14T15:07:01
2026-06-15T15:24:49
flamant
true
null
null
5,032,020
825
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79958822
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79958822/fitting-an-image-inside-ctklabel
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,958,822
Fitting an image inside CtkLabel
0
105
2
true
false
[ "python", "user-interface", "customtkinter" ]
2026-06-14T13:40:02
2026-06-14T19:14:55
Mahdi Soleimani
false
CC BY-SA 4.0
null
19,307,552
13
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79958783
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79958783/best-ways-to-concatinate-strings-in-python
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,958,783
Best ways to concatinate strings in python
0
205
8
true
false
[ "python", "python-3.x", "string", "char" ]
2026-06-14T11:17:05
2026-06-17T06:10:32
user32836321
false
CC BY-SA 4.0
null
32,836,321
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79958664
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79958664/i-want-to-run-forge-neo-on-google-colaboratory
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,958,664
I want to run Forge Neo on Google Colaboratory
-4
193
1
false
false
[ "python", "google-colaboratory", "gradio" ]
2026-06-13T23:27:06
2026-06-16T10:29:29
長々白鷺
false
CC BY-SA 4.0
null
32,835,181
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79958544
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79958544/pb-de-version-python-installation
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,958,544
pb de version Python Installation
-9
112
1
true
false
[ "python" ]
2026-06-13T14:57:38
2026-06-13T15:05:00
Christophe Arnaud
false
CC BY-SA 4.0
null
30,856,407
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79958517
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79958517/fastapi-returns-422-unprocessable-entity-on-post-from-next-js-fetch-despite-matc
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,958,517
FastAPI returns 422 Unprocessable Entity on POST from Next.js fetch despite matching Pydantic model
-1
64
1
false
false
[ "python", "next.js", "http-post", "fastapi", "pydantic" ]
2026-06-13T13:23:27
2026-06-13T13:26:32
Debanshu Paul
true
null
null
28,411,679
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79958459
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79958459/how-does-python-handle-floating-point-numbers-when-the-round-function-is-also-in
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,958,459
How does Python handle floating point numbers when the round function is also involved?
0
174
5
true
false
[ "python", "python-idle" ]
2026-06-13T09:58:35
2026-06-15T09:55:51
Nimish
false
CC BY-SA 4.0
null
25,342,315
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79958384
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79958384/is-it-better-for-users-to-get-raw-information-or-the-tidied-up-information-from
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,958,384
Is it better for users to get raw information or the tidied up information from the functions in my python library?
1
141
4
true
false
[ "python" ]
2026-06-13T05:17:16
2026-06-15T17:46:55
Ellan Aqira
false
CC BY-SA 4.0
null
32,832,798
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79957336
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79957336/how-to-display-names-instead-of-ids-using-django-with-react
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,957,336
How to display names instead of IDs, using Django with React?
2
177
1
true
false
[ "python", "django" ]
2026-06-12T22:15:00
2026-06-16T07:37:15
Andres Vilca
false
CC BY-SA 4.0
null
12,369,063
145
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79957305
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79957305/could-this-logging-setup-code-be-rationalised
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,957,305
Could this logging setup code be rationalised
1
186
5
true
false
[ "python", "python-3.x", "python-logging" ]
2026-06-12T20:02:04
2026-06-22T05:48:20
NickC
false
CC BY-SA 4.0
null
669,301
1,421
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79957200
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79957200/why-does-divmod-run-slower-than-successive-division-taking-the-remainder
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,957,200
Why does divmod() run slower than successive division + taking the remainder?
1
120
3
true
false
[ "python", "prime-factoring", "factorization", "divmod" ]
2026-06-12T15:18:30
2026-06-12T18:35:06
Constantine
false
CC BY-SA 4.0
null
2,229,705
11
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79957194
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79957194/azure-durable-functions-fan-out-fan-in-with-durable-timers
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,957,194
Azure Durable Functions Fan-out/Fan-in with Durable Timers
0
66
1
false
false
[ "python", "azure-functions" ]
2026-06-12T14:59:41
2026-06-17T11:40:44
euh
false
CC BY-SA 4.0
null
13,158,157
525
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79957069
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79957069/counting-items-in-column-or-why-is-my-code-only-counting-one-item-in-the-string
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,957,069
Counting items in column or why is my code only counting one item in the string?
-1
153
1
true
false
[ "python", "pandas" ]
2026-06-12T11:22:11
2026-06-12T15:39:22
Dragoran21
false
CC BY-SA 4.0
null
32,365,167
47
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956975
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956975/is-python-an-efficient-way-to-automate-view-table-construction-for-database
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,975
Is Python an efficient way to automate View/Table construction for database?
0
174
14
true
false
[ "python", "postgresql", "view", "automation" ]
2026-06-12T08:20:17
2026-06-18T06:17:01
Archipel
false
CC BY-SA 4.0
null
32,829,195
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956908
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956908/await-may-it-be-called-several-times-and-then-wait-again
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,908
__await__: may it be called several times and then wait again?
0
162
5
true
false
[ "python", "python-3.x", "async-await", "python-asyncio", "coroutine" ]
2026-06-12T06:04:48
2026-06-17T12:18:54
glglgl
false
CC BY-SA 4.0
null
296,974
91,720
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956885
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956885/vectorising-weight-average-over-time
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,885
Vectorising weight average over time
2
162
2
false
false
[ "python", "numpy", "vectorization" ]
2026-06-12T04:42:25
2026-06-14T02:33:27
orange
false
CC BY-SA 4.0
null
1,230,724
8,300
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956827
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956827/what-are-the-essential-pytorch-cnn-components-and-syntax-i-should-know-for-build
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,827
What are the essential PyTorch CNN components and syntax I should know for building image classification models?
0
68
1
true
false
[ "python", "pytorch", "neural-network" ]
2026-06-12T00:59:58
2026-06-12T01:23:31
Sabby Smith
false
CC BY-SA 4.0
null
32,828,215
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956737
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956737/how-can-i-get-a-source-code-of-python-function-which-was-declared-by-using-exec
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,737
How can I get a source code of Python function which was declared by using 'exec' inside other function?
2
214
17
true
false
[ "python", "function", "inspect" ]
2026-06-11T18:49:58
2026-06-14T11:06:05
Yaroslav_A
false
CC BY-SA 4.0
null
19,741,630
121
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956724
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956724/custom-part-varmain-aqa-scripting-in-plant-3d-using-python
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,724
Custom Part varmain/aqa scripting in Plant 3D using python
-1
79
0
false
false
[ "python", "scripting", "3d" ]
2026-06-11T18:27:19
2026-06-12T15:29:10
Krithik Tamilselvan
false
CC BY-SA 4.0
null
29,097,010
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956670
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956670/how-much-business-logic-should-live-in-shopify-metaobjects-versus-an-external-fl
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,670
How much business logic should live in Shopify Metaobjects versus an external Flask backend?
0
71
1
false
false
[ "python", "java", "flask", "shopify", "liquid" ]
2026-06-11T17:03:42
2026-07-22T10:24:59
Practical Method Web Solutions
false
CC BY-SA 4.0
null
32,827,337
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956620
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956620/wsgi-start-response-or-add-header
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,620
WSGI start_response or add_header()
0
79
5
true
false
[ "python", "python-3.x", "wsgi", "wsgiref", "wsgiserver" ]
2026-06-11T15:22:38
2026-06-11T21:18:50
NickC
false
CC BY-SA 4.0
null
669,301
1,421
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956615
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956615/why-is-it-so-difficult-to-train-an-accuracte-gan-model
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,615
Why is it so difficult to train an accuracte GAN model?
0
97
1
true
false
[ "python", "tensorflow", "machine-learning", "neural-network" ]
2026-06-11T15:12:58
2026-06-12T14:03:03
Sandesh Singh
false
CC BY-SA 4.0
null
32,826,848
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956583
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956583/how-are-bert-embeddings-different-to-glove
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,583
how are bert embeddings different to glove?
0
54
1
false
false
[ "python" ]
2026-06-11T14:20:45
2026-06-11T14:46:25
Sandesh Singh
false
CC BY-SA 4.0
null
32,826,848
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956581
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956581/how-to-visualize-the-convolution-layer-of-a-cnn
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,581
How to visualize the convolution layer of a CNN?
1
89
0
false
false
[ "python", "tensorflow", "conv-neural-network" ]
2026-06-11T14:17:55
2026-06-11T17:08:00
Sandesh Singh
false
CC BY-SA 4.0
null
32,826,848
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956563
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956563/ccxt-connection-with-api-fails
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,563
ccxt connection with api fails
0
33
0
false
false
[ "python", "ccxt", "bybit" ]
2026-06-11T13:57:30
2026-06-11T13:57:30
fra bre
true
null
null
30,909,692
86
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956503
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956503/how-to-count-how-many-times-string-x-appears-in-a-row-and-how-to-turn-answer-in
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,503
How to count how many times string X appears in a row (and how to turn answer into a table)?
0
186
9
true
false
[ "python", "pandas" ]
2026-06-11T12:18:12
2026-06-24T17:35:53
Dragoran21
false
CC BY-SA 4.0
null
32,365,167
47
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956436
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956436/indexerror-list-index-out-of-range-in-python-how-to-capture-the-last-item-in
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,436
IndexError: list index out of range in Python - how to capture the last item in a list?
-9
155
1
false
false
[ "python" ]
2026-06-11T10:24:49
2026-06-12T04:12:38
John Gibbonsp
true
null
null
32,826,048
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956428
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956428/vk-api-photos-savemessagesphoto-fails-with-photo-is-undefined-after-getmessage
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,428
VK API photos.saveMessagesPhoto fails with "photo is undefined" after getMessagesUploadServer returns v2/bulk_upload URL
0
125
1
true
false
[ "python", "vk" ]
2026-06-11T10:14:35
2026-06-11T12:43:21
DBNSTR
false
CC BY-SA 4.0
null
16,473,715
21
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956384
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956384/mh-attention-mha-with-pytorch-to-process-a-sequence
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,384
MH attention (MHA) with pytorch to process a sequence
1
61
1
false
false
[ "python", "pytorch", "neural-network", "seaborn" ]
2026-06-11T08:45:44
2026-06-30T04:01:15
coolcoder8798
false
CC BY-SA 4.0
null
32,824,857
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956236
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956236/is-this-the-correct-way-of-making-correlation-plot-using-sns
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,236
is this the correct way of making correlation plot using sns?
1
75
1
true
false
[ "python", "seaborn" ]
2026-06-11T02:37:11
2026-06-11T03:49:11
Saiking
false
CC BY-SA 4.0
null
32,824,700
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956212
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956212/regex-search-replace-over-multiple-lines-in-visual-studio-code
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,212
Regex Search & Replace over multiple lines in Visual Studio Code
0
190
7
true
false
[ "python", "regex", "visual-studio-code" ]
2026-06-11T00:04:35
2026-06-12T14:03:12
Larry k
false
CC BY-SA 4.0
null
32,824,567
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956192
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956192/plotly-distinct-base-colors-per-group-with-per-trace-lightness-gradient-within
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,192
Plotly: distinct base colors per group with per-trace lightness gradient within each group
1
112
2
true
false
[ "python", "plotly" ]
2026-06-10T22:43:56
2026-06-11T10:19:36
Vem
false
CC BY-SA 4.0
null
20,601,838
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79956021
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79956021/why-is-my-training-loss-not-decreasing-while-fine-tuning-qwen-with-unsloth
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,956,021
Why is my training loss not decreasing while fine-tuning Qwen with Unsloth?
1
155
8
false
false
[ "python", "pytorch", "artificial-intelligence" ]
2026-06-10T12:57:57
2026-06-10T17:29:30
Ali-Yaser
false
CC BY-SA 4.0
null
32,823,134
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79955945
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79955945/why-does-pathlib-path-mkdir-raise-filenotfounderror-when-creating-nested-direc
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,955,945
Why does pathlib.Path.mkdir() raise FileNotFoundError when creating nested directories?
-9
186
1
true
false
[ "python", "pathlib" ]
2026-06-10T09:08:27
2026-07-09T00:33:55
user32705800
true
null
null
32,705,800
1
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
79954769
question
stackoverflow
2026-08-03T01:26:22
null
null
null
null
null
https://stackoverflow.com/questions/79954769/how-to-fix-this-python-code-to-count-different-sized-length-samples-in-an-imag
Oy4r0hp1G2qqSHyib
zb4lG7Syjdk17Mkm8
79,954,769
How to fix this python code to count different sized (length) samples in an image?
0
369
1
true
false
[ "python", "opencv", "image-processing", "computer-vision" ]
2026-06-09T19:04:06
2026-06-20T16:26:37
pippo1980
false
CC BY-SA 4.0
null
9,877,065
3,405
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
5767325
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/5767325/how-can-i-remove-a-specific-item-from-an-array-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
5,767,325
How can I remove a specific item from an array in JavaScript?
12,258
13,625,940
51
true
true
[ "javascript", "arrays" ]
2011-04-23T22:17:18
2026-03-01T02:48:12
Walker
false
CC BY-SA 4.0
5,767,357
364,969
135,681
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I remove a specific value from an array? Something like: array.remove(value); Constraints: I have to use core JavaScript. Frameworks are not allowed.
<p>How do I remove a specific value from an array? Something like:</p> <pre class="lang-js prettyprint-override"><code>array.remove(value); </code></pre> <p>Constraints: I have to use <strong>core</strong> JavaScript. Frameworks are not allowed.</p>
[ { "answerId": 5767357, "score": 17035, "isAccepted": true, "createdAt": "2011-04-23T22:23:50", "ownerDisplayName": "Tom Wadley", "ownerUserId": 613430, "bodyText": "Find the index of the array element you want to remove using indexOf , and then remove that index with splice . The splice(...
2
178325
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/178325/how-do-i-check-if-an-element-is-hidden-in-jquery
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
178,325
How do I check if an element is hidden in jQuery?
8,740
3,266,232
67
true
true
[ "javascript", "jquery", "dom", "visibility", "display" ]
2008-10-07T13:03:18
2025-09-26T11:23:42
Philip Morton
false
CC BY-SA 4.0
178,450
21,709
132,419
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I toggle the visibility of an element using .hide() , .show() , or .toggle() ? How do I test if an element is visible or hidden ?
<p>How do I toggle the visibility of an element using <code>.hide()</code>, <code>.show()</code>, or <code>.toggle()</code>?</p> <p>How do I test if an element is <code>visible</code> or <code>hidden</code>?</p>
[ { "answerId": 178450, "score": 10303, "isAccepted": true, "createdAt": "2008-10-07T13:30:22", "ownerDisplayName": "Tsvetomir Tsonev", "ownerUserId": 25449, "bodyText": "Since the question refers to a single element, this code might be more suitable: // Checks CSS content for display:[non...
1
1335851
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1335851/what-does-use-strict-do-in-javascript-and-what-is-the-reasoning-behind-it
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,335,851
What does "use strict" do in JavaScript, and what is the reasoning behind it?
8,545
1,237,715
32
true
true
[ "javascript", "syntax", "jslint", "use-strict" ]
2009-08-26T16:10:13
2024-08-03T06:13:53
Mark Rogers
false
CC BY-SA 4.0
1,335,881
25,847
97,943
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Recently, I ran some of my JavaScript code through Crockford's JSLint , and it gave the following error: Problem at line 1 character 1: Missing "use strict" statement. Doing some searching, I realized that some people add "use strict"; into their JavaScript code. Once I added the statement, the error stopped appearing....
<p>Recently, I ran some of my JavaScript code through Crockford's <a href="http://www.jslint.com/" rel="noreferrer">JSLint</a>, and it gave the following error:</p> <blockquote> <p>Problem at line 1 character 1: Missing &quot;use strict&quot; statement.</p> </blockquote> <p>Doing some searching, I realized that some pe...
[ { "answerId": 1335881, "score": 5529, "isAccepted": true, "createdAt": "2009-08-26T16:15:39", "ownerDisplayName": "Pascal MARTIN", "ownerUserId": 138475, "bodyText": "Update for ES6 modules Inside native ECMAScript modules (with import and export statements) and ES6 classes , strict mode...
1
503093
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/503093/how-do-i-redirect-to-another-webpage
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
503,093
How do I redirect to another webpage?
7,693
8,182,430
58
true
true
[ "javascript", "jquery", "http-redirect" ]
2009-02-02T12:54:16
2025-06-13T08:52:11
venkatachalam
false
CC BY-SA 3.0
506,004
44,984
102,407
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How can I redirect the user from one page to another using jQuery or pure JavaScript?
<p>How can I redirect the user from one page to another using jQuery or pure JavaScript?</p>
[ { "answerId": 506004, "score": 16470, "isAccepted": true, "createdAt": "2009-02-03T04:24:09", "ownerDisplayName": "Ryan McGeary", "ownerUserId": 8985, "bodyText": "One does not simply redirect using jQuery jQuery is not necessary, and window.location.replace(...) will best simulate an HT...
1
336859
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/336859/var-functionname-function-vs-function-functionname
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
336,859
var functionName = function() {} vs function functionName() {}
7,669
1,246,008
42
true
true
[ "javascript", "function", "methods", "syntax" ]
2008-12-03T11:31:07
2024-04-23T15:08:21
Richard Garside
false
CC BY-SA 4.0
336,868
31,569
89,565
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I've recently started maintaining someone else's JavaScript code. I'm fixing bugs, adding features and also trying to tidy up the code and make it more consistent. The previous developer used two ways of declaring functions and I can't work out if there is a reason behind it or not. The two ways are: var functionOne = ...
<p>I've recently started maintaining someone else's JavaScript code. I'm fixing bugs, adding features and also trying to tidy up the code and make it more consistent.</p> <p>The previous developer used two ways of declaring functions and I can't work out if there is a reason behind it or not.</p> <p>The two ways are:</...
[ { "answerId": 336868, "score": 5623, "isAccepted": true, "createdAt": "2008-12-03T11:37:42", "ownerDisplayName": "Greg", "ownerUserId": 24181, "bodyText": "The difference is that functionOne is a function expression and so only defined when that line is reached, whereas functionTwo is a ...
1
111102
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/111102/how-do-javascript-closures-work
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
111,102
How do JavaScript closures work?
7,608
1,637,314
85
true
true
[ "javascript", "function", "variables", "scope", "closures" ]
2008-09-21T14:12:07
2023-07-16T17:04:37
Bite code
false
CC BY-SA 3.0
111,111
9,951
601,871
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves? I have seen the Scheme example given on Wikipedia, but unfortunately it did not help.
<p>How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves?</p> <p>I have seen <a href="http://en.wikipedia.org/wiki/Scheme_%28programming_language%29" rel="noreferrer">the Scheme ...
[ { "answerId": 111111, "score": 8349, "isAccepted": true, "createdAt": "2008-09-21T14:18:18", "ownerDisplayName": "Joel Anair", "ownerUserId": 7441, "bodyText": "A closure is a pairing of: A function and A reference to that function's outer scope (lexical environment) A lexical environmen...
3
208105
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/208105/how-do-i-remove-a-property-from-a-javascript-object
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
208,105
How do I remove a property from a JavaScript object?
7,584
3,404,075
40
true
true
[ "javascript", "object", "properties" ]
2008-10-16T10:57:45
2026-07-13T11:41:22
johnstok
false
CC BY-SA 4.0
208,106
27,929
98,560
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Given an object: let myObject = { "ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*" }; How do I remove the property regex to end up with the following myObject ? let myObject = { "ircEvent": "PRIVMSG", "method": "newURI" };
<p>Given an object:</p> <pre><code>let myObject = { &quot;ircEvent&quot;: &quot;PRIVMSG&quot;, &quot;method&quot;: &quot;newURI&quot;, &quot;regex&quot;: &quot;^http://.*&quot; }; </code></pre> <p>How do I remove the property <code>regex</code> to end up with the following <code>myObject</code>?</p> <pre><code>le...
[ { "answerId": 208106, "score": 10000, "isAccepted": true, "createdAt": "2008-10-16T10:58:53", "ownerDisplayName": "nickf", "ownerUserId": 9021, "bodyText": "To remove a property from an object (mutating the object), you can do it by using the delete keyword, like this: delete myObject.re...
1
1789945
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1789945/how-to-check-whether-a-string-contains-a-substring-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,789,945
How to check whether a string contains a substring in JavaScript?
7,402
8,381,876
3
true
true
[ "javascript", "string", "substring", "string-matching" ]
2009-11-24T13:04:29
2022-10-18T06:47:43
gramm
false
CC BY-SA 4.0
1,789,952
131,679
18,824
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Usually I would expect a String.contains() method, but there doesn't seem to be one. What is a reasonable way to check for this?
<p>Usually I would expect a <code>String.contains()</code> method, but there doesn't seem to be one. </p> <p>What is a reasonable way to check for this?</p>
[ { "answerId": 1789952, "score": 16100, "isAccepted": true, "createdAt": "2009-11-24T13:05:36", "ownerDisplayName": "Fabien Ménager", "ownerUserId": 92315, "bodyText": "ECMAScript 6 introduced String.prototype.includes : const string = \"foo\"; const substring = \"oo\"; console.log(string...
1
14220321
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
14,220,321
How do I return the response from an asynchronous call?
6,744
2,185,732
44
true
true
[ "javascript", "ajax", "asynchronous" ]
2013-01-08T17:06:14
2025-03-04T19:20:50
Felix Kling
false
CC BY-SA 4.0
14,220,323
218,196
821,265
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I return the response/result from a function foo that makes an asynchronous request? I am trying to return the value from the callback, as well as assigning the result to a local variable inside the function and returning that one, but none of those ways actually return the response — they all return undefined o...
<p>How do I return the response/result from a function <code>foo</code> that makes an asynchronous request?</p> <p>I am trying to return the value from the callback, as well as assigning the result to a local variable inside the function and returning that one, but none of those ways actually return the response — they...
[ { "answerId": 14220323, "score": 6659, "isAccepted": true, "createdAt": "2013-01-08T17:06:14", "ownerDisplayName": "Felix Kling", "ownerUserId": 218196, "bodyText": "→ For a more general explanation of asynchronous behaviour with different examples, see Why is my variable unaltered after...
1
762011
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/762011/what-is-the-difference-between-let-and-var
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
762,011
What is the difference between "let" and "var"?
6,415
2,438,082
35
true
true
[ "javascript", "scope", "ecmascript-6", "var", "let" ]
2009-04-17T20:09:26
2026-05-02T20:03:47
TM.
false
CC BY-SA 4.0
11,444,416
12,983
111,837
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
ECMAScript 6 introduced the let declaration keyword . I've heard that it's described as a local variable, but I'm still not quite sure how it behaves differently than the var keyword. What are the differences? When should let be used instead of var ?
<p>ECMAScript 6 introduced <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let" rel="noreferrer">the <code>let</code> declaration keyword</a>.</p> <p>I've heard that it's described as a local variable, but I'm still not quite sure how it behaves differently than the <code>var</code...
[ { "answerId": 11444416, "score": 8401, "isAccepted": true, "createdAt": "2012-07-12T02:53:34", "ownerDisplayName": "ThinkingStiff", "ownerUserId": 918414, "bodyText": "Scoping rules The main difference is scoping rules. Variables declared by var keyword are scoped to the immediate functi...
1
950087
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/950087/how-do-i-include-a-javascript-file-in-another-javascript-file
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
950,087
How do I include a JavaScript file in another JavaScript file?
6,382
4,554,038
72
true
true
[ "javascript", "file", "import", "include" ]
2009-06-04T11:59:50
2024-06-19T09:29:12
Alec Smart
false
CC BY-SA 4.0
950,146
426,996
96,242
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I include a JavaScript file inside another JavaScript file, similar to @import in CSS?
<p>How do I include a JavaScript file inside another JavaScript file, similar to <code>@import</code> in CSS?</p>
[ { "answerId": 950146, "score": 5485, "isAccepted": true, "createdAt": "2009-06-04T12:13:28", "ownerDisplayName": "Bite code", "ownerUserId": 9951, "bodyText": "The old versions of JavaScript had no import, include, or require, so many different approaches to this problem have been develo...
1
9329446
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/9329446/loop-for-each-over-an-array-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
9,329,446
Loop (for each) over an array in JavaScript
5,811
5,550,019
41
true
true
[ "javascript", "arrays", "loops", "foreach", "iteration" ]
2012-02-17T13:51:48
2025-01-23T12:43:23
Dante1986
false
CC BY-SA 4.0
9,329,476
1,140,876
60,353
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How can I loop through all the entries in an array using JavaScript?
<p>How can I loop through all the entries in an array using JavaScript?</p>
[ { "answerId": 9329476, "score": 8606, "isAccepted": true, "createdAt": "2012-02-17T13:53:44", "ownerDisplayName": "T.J. Crowder", "ownerUserId": 157247, "bodyText": "TL;DR Your best bets are usually a for-of loop (ES2015+ only; spec | MDN ) - simple and async -friendly for (const element...
1
359494
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/359494/which-equals-operator-vs-should-be-used-in-javascript-comparisons
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
359,494
Which equals operator (== vs ===) should be used in JavaScript comparisons?
5,642
2,233,020
47
true
true
[ "javascript", "operators", "equality", "equality-operator", "identity-operator" ]
2008-12-11T14:19:49
2026-05-31T18:29:59
bcasp
false
CC BY-SA 3.0
359,509
44,990
57,337
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I'm using JSLint to go through JavaScript, and it's returning many suggestions to replace == (two equals signs) with === (three equals signs) when doing things like comparing idSele_UNVEHtype.value.length == 0 inside of an if statement. Is there a performance benefit to replacing == with === ? Any performance improveme...
<p>I'm using <a href="http://en.wikipedia.org/wiki/JSLint" rel="noreferrer">JSLint</a> to go through JavaScript, and it's returning many suggestions to replace <code>==</code> (two equals signs) with <code>===</code> (three equals signs) when doing things like comparing <code>idSele_UNVEHtype.value.length == 0</code> i...
[ { "answerId": 359509, "score": 7224, "isAccepted": true, "createdAt": "2008-12-11T14:25:06", "ownerDisplayName": "Bill the Lizard", "ownerUserId": 1288, "bodyText": "The strict equality operator ( === ) behaves identically to the abstract equality operator ( == ) except no type conversio...
1
1144783
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1144783/how-do-i-replace-all-occurrences-of-a-string
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,144,783
How do I replace all occurrences of a string?
5,518
4,638,864
50
true
true
[ "javascript", "string", "replace" ]
2009-07-17T17:53:46
2025-01-29T13:39:20
Ali
false
CC BY-SA 4.0
1,145,525
49,153
268,312
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Given a string: string = "Test abc test test abc test test test abc test test abc"; This seems to only remove the first occurrence of abc in the string above: string = string.replace('abc', ''); How do I replace all occurrences of it?
<p>Given a string:</p> <pre><code>string = &quot;Test abc test test abc test test test abc test test abc&quot;; </code></pre> <p>This seems to only remove the first occurrence of <code>abc</code> in the string above:</p> <pre><code>string = string.replace('abc', ''); </code></pre> <p>How do I replace <em>all</em> occur...
[ { "answerId": 1144788, "score": 5258, "isAccepted": false, "createdAt": "2009-07-17T17:54:49", "ownerDisplayName": "user21926", "ownerUserId": null, "bodyText": "As of August 2020: Modern browsers have support for the String.replaceAll() method defined by the ECMAScript 2021 language spe...
3
105034
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/105034/how-do-i-create-a-guid-uuid
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
105,034
How do I create a GUID / UUID?
5,501
3,334,635
77
true
true
[ "javascript", "guid", "uuid" ]
2008-09-19T20:01:00
2025-10-17T08:33:07
Jason Cohen
false
CC BY-SA 4.0
105,074
4,926
83,703
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I create GUIDs (globally-unique identifiers) in JavaScript? The GUID / UUID should be at least 32 characters and should stay in the ASCII range to avoid trouble when passing them around. I'm not sure what routines are available on all browsers, how "random" and seeded the built-in random number generator is, etc...
<p>How do I create GUIDs (globally-unique identifiers) in JavaScript? The GUID / UUID should be at least 32 characters and should stay in the ASCII range to avoid trouble when passing them around.</p> <p>I'm not sure what routines are available on all browsers, how &quot;random&quot; and seeded the built-in random numb...
[ { "answerId": 2117523, "score": 5766, "isAccepted": false, "createdAt": "2010-01-22T13:40:20", "ownerDisplayName": "broofa", "ownerUserId": 109538, "bodyText": "[Edited 2023-03-05 to reflect latest best-practices for producing RFC4122-compliant UUIDs] crypto.randomUUID() is now standard ...
2
46155
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/46155/how-can-i-validate-an-email-address-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
46,155
How can I validate an email address in JavaScript?
5,466
4,936,535
78
true
true
[ "javascript", "html", "regex", "email-validation" ]
2008-09-05T16:10:11
2025-01-03T21:51:06
pix0r
false
CC BY-SA 4.0
46,181
72
31,340
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I'd like to check if the user input is an email address in JavaScript, before sending it to a server or attempting to send an email to it, to prevent the most basic mistyping. How could I achieve this?
<p>I'd like to check if the user input is an email address in JavaScript, before sending it to a server or attempting to send an email to it, to prevent the most basic mistyping. How could I achieve this?</p>
[ { "answerId": 46181, "score": 6668, "isAccepted": true, "createdAt": "2008-09-05T16:15:34", "ownerDisplayName": "John Rutherford", "ownerUserId": 3880, "bodyText": "Using regular expressions is probably the best way of validating an email address in JavaScript. View a bunch of tests on J...
1
901712
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/901712/how-do-i-check-whether-a-checkbox-is-checked-in-jquery
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
901,712
How do I check whether a checkbox is checked in jQuery?
5,231
4,967,100
68
true
true
[ "javascript", "jquery", "html", "checkbox" ]
2009-05-23T15:16:39
2024-07-04T11:07:19
Prasad
false
CC BY-SA 4.0
903,152
111,435
59,669
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I need to check the checked property of a checkbox and perform an action based on the checked property using jQuery. For example, if the age checkbox is checked, then I need to show a textbox to enter age , else hide the textbox. But the following code returns false by default: if ($('#isAgeSelected').attr('checked')) ...
<p>I need to check the <code>checked</code> property of a checkbox and perform an action based on the checked property using jQuery.</p> <p>For example, if the <code>age</code> checkbox is checked, then I need to show a textbox to enter <code>age</code>, else hide the textbox.</p> <p>But the following code returns <cod...
[ { "answerId": 901727, "score": 3682, "isAccepted": false, "createdAt": "2009-05-23T15:20:33", "ownerDisplayName": "karim79", "ownerUserId": 70393, "bodyText": "How do I successfully query the checked property? The checked property of a checkbox DOM element will give you the checked state...
1
122102
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/122102/what-is-the-most-efficient-way-to-deep-clone-an-object-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
122,102
What is the most efficient way to deep clone an object in JavaScript?
5,156
3,071,134
67
true
true
[ "javascript", "object", "clone" ]
2008-09-23T16:26:09
2024-08-05T18:00:43
jschrab
false
CC BY-SA 3.0
122,704
12,694
11,015
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
What is the most efficient way to clone a JavaScript object? I've seen obj = eval(uneval(o)); being used, but that's non-standard and only supported by Firefox . I've done things like obj = JSON.parse(JSON.stringify(o)); but question the efficiency. I've also seen recursive copying functions with various flaws. I'm sur...
<p>What is the most efficient way to clone a JavaScript object? I've seen <code>obj = eval(uneval(o));</code> being used, but <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/uneval" rel="noreferrer">that's non-standard and only supported by Firefox</a>.<br/><br/> I've done thin...
[ { "answerId": 122704, "score": 6002, "isAccepted": true, "createdAt": "2008-09-23T18:09:37", "ownerDisplayName": "John Resig", "ownerUserId": 6524, "bodyText": "Native deep cloning There's now a structuredClone(value) function supported in all major browsers and node >= 17. It has polyfi...
2
237104
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/237104/how-do-i-check-if-an-array-includes-a-value-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
237,104
How do I check if an array includes a value in JavaScript?
5,010
3,744,998
65
true
true
[ "javascript", "arrays", "algorithm", "time-complexity", "javascript-objects" ]
2008-10-25T22:14:40
2026-04-16T17:07:44
brad
false
CC BY-SA 4.0
1,473,742
208
75,904
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
What is the most concise and efficient way to find out if a JavaScript array contains a value? This is the only way I know to do it: function contains(a, obj) { for (var i = 0; i < a.length; i++) { if (a[i] === obj) { return true; } } return false; } Is there a better and more concise way to accomplish this? This is ve...
<p>What is the most concise and efficient way to find out if a JavaScript array contains a value?</p> <p>This is the only way I know to do it:</p> <pre><code>function contains(a, obj) { for (var i = 0; i &lt; a.length; i++) { if (a[i] === obj) { return true; } } return false; } <...
[ { "answerId": 1473742, "score": 5535, "isAccepted": true, "createdAt": "2009-09-24T19:35:24", "ownerDisplayName": "codeape", "ownerUserId": 3571, "bodyText": "Modern browsers have Array#includes , which does exactly that and is widely supported by everyone except IE: console.log(['joe', ...
1
221294
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/221294/how-do-i-get-a-timestamp-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
221,294
How do I get a timestamp in JavaScript?
4,932
4,660,169
37
true
true
[ "javascript", "datetime", "timestamp", "date-arithmetic" ]
2008-10-21T09:29:33
2025-06-11T10:39:01
Pablo Fernandez
false
CC BY-SA 4.0
221,297
6,068
290,140
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I want a single number that represents the current date and time, like a Unix timestamp .
<p>I want a single number that represents the current date and time, like a <a href="https://en.wikipedia.org/wiki/Unix_time" rel="noreferrer">Unix timestamp</a>.</p>
[ { "answerId": 221297, "score": 6184, "isAccepted": true, "createdAt": "2008-10-21T09:32:32", "ownerDisplayName": "daveb", "ownerUserId": 11858, "bodyText": "Timestamp in milliseconds To get the number of milliseconds since Unix epoch , call Date.now : Date.now() Alternatively, use the un...
1
426258
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/426258/setting-checked-for-a-checkbox-with-jquery
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
426,258
Setting "checked" for a checkbox with jQuery
4,608
3,910,092
44
true
true
[ "javascript", "jquery", "checkbox", "selected", "checked" ]
2009-01-08T22:20:24
2023-08-02T12:29:21
tpower
false
CC BY-SA 4.0
426,276
18,107
57,006
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I'd like to do something like this to tick a checkbox using jQuery : $(".myCheckBox").checked(true); or $(".myCheckBox").selected(true); Does such a thing exist?
<p>I'd like to do something like this to tick a <code>checkbox</code> using <strong>jQuery</strong>:</p> <pre><code>$(".myCheckBox").checked(true); </code></pre> <p>or</p> <pre><code>$(".myCheckBox").selected(true); </code></pre> <p>Does such a thing exist?</p>
[ { "answerId": 426276, "score": 6458, "isAccepted": true, "createdAt": "2009-01-08T22:25:08", "ownerDisplayName": "Xian", "ownerUserId": 4642, "bodyText": "Modern jQuery Use .prop() : $('.myCheckbox').prop('checked', true); $('.myCheckbox').prop('checked', false); DOM API If you're workin...
1
2669690
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/2669690/why-does-google-prepend-while1-to-their-json-responses
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
2,669,690
Why does Google prepend while(1); to their JSON responses?
4,508
611,230
8
true
true
[ "javascript", "json", "ajax", "security" ]
2010-04-19T18:00:09
2025-11-08T19:00:20
Jess
false
CC BY-SA 4.0
2,669,766
151,495
43,038
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Why does Google prepend while(1); to their (private) JSON responses? For example, here's a response while turning a calendar on and off in Google Calendar : while (1); [ ['u', [ ['smsSentFlag', 'false'], ['hideInvitations', 'false'], ['remindOnRespondedEventsOnly', 'true'], ['hideInvitations_remindOnRespondedEventsOnly...
<p>Why does Google prepend <code>while(1);</code> to their (private) JSON responses?</p> <p>For example, here's a response while turning a calendar on and off in <a href="https://calendar.google.com/calendar/about/" rel="noreferrer">Google Calendar</a>:</p> <pre><code>while (1); [ ['u', [ ['smsSentFlag', 'false...
[ { "answerId": 2669766, "score": 4599, "isAccepted": true, "createdAt": "2010-04-19T18:11:41", "ownerDisplayName": "rjh", "ownerUserId": 74496, "bodyText": "It prevents JSON hijacking , a major JSON security issue that is formally fixed in all major browsers since 2011 with ECMAScript 5. ...
1
14994391
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/14994391/thinking-in-angularjs-if-i-have-a-jquery-background
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
14,994,391
"Thinking in AngularJS" if I have a jQuery background?
4,498
857,754
15
true
true
[ "javascript", "jquery", "angularjs" ]
2013-02-21T04:09:56
2018-11-02T23:22:39
Mark Rajcok
true
null
15,012,542
215,945
365,045
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Suppose I'm familiar with developing client-side applications in jQuery , but now I'd like to start using AngularJS . Can you describe the paradigm shift that is necessary? Here are a few questions that might help you frame an answer: How do I architect and design client-side web applications differently? What is the b...
<p>Suppose I'm familiar with developing client-side applications in <a href="http://jquery.com/" rel="noreferrer">jQuery</a>, but now I'd like to start using <a href="http://angularjs.org/" rel="noreferrer">AngularJS</a>. Can you describe the paradigm shift that is necessary? Here are a few questions that might help yo...
[ { "answerId": 15012542, "score": 7153, "isAccepted": true, "createdAt": "2013-02-21T21:26:42", "ownerDisplayName": "Josh David Miller", "ownerUserId": 259038, "bodyText": "1. Don't design your page, and then change it with DOM manipulations In jQuery, you design a page, and then you make...
1
586182
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/586182/how-can-i-insert-an-item-into-an-array-at-a-specific-index
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
586,182
How can I insert an item into an array at a specific index?
4,355
3,694,949
34
true
true
[ "javascript", "arrays" ]
2009-02-25T14:29:30
2025-11-02T02:06:08
tags2k
false
CC BY-SA 4.0
586,189
192
84,775
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I am looking for a JavaScript array insert method, in the style of: arr.insert(index, item) It should preferably be in jQuery, but any JavaScript implementation will do at this point.
<p>I am looking for a JavaScript array insert method, in the style of:</p> <pre><code>arr.insert(index, item) </code></pre> <p>It should preferably be in jQuery, but any JavaScript implementation will do at this point.</p>
[ { "answerId": 586189, "score": 6880, "isAccepted": true, "createdAt": "2009-02-25T14:32:56", "ownerDisplayName": "tvanfosson", "ownerUserId": 12950, "bodyText": "You want the splice function on the native array object. arr.splice(index, 0, item); will insert item into arr at the specifie...
1
400212
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
400,212
How do I copy to the clipboard in JavaScript?
4,342
3,110,625
27
true
true
[ "javascript", "clipboard", "copy-paste" ]
2008-12-30T13:09:05
2023-02-01T07:16:11
Santiago Corredoira
false
CC BY-SA 4.0
30,810,322
4,264
47,296
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I copy text to the clipboard (multi-browser)? Related: How does Trello access the user's clipboard?
<p>How do I copy text to the clipboard (multi-browser)?</p> <p>Related: <em><a href="https://stackoverflow.com/questions/17527870/how-does-trello-access-the-users-clipboard">How does Trello access the user&#39;s clipboard?</a></em></p>
[ { "answerId": 30810322, "score": 3620, "isAccepted": true, "createdAt": "2015-06-12T18:56:18", "ownerDisplayName": "Dean Taylor", "ownerUserId": 406712, "bodyText": "Overview There are three primary browser APIs for copying to the clipboard: Async Clipboard API [navigator.clipboard.write...
1
11832914
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/11832914/how-to-round-to-at-most-2-decimal-places-if-necessary
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
11,832,914
How to round to at most 2 decimal places, if necessary
4,336
4,958,146
95
true
true
[ "javascript", "rounding", "decimal-point" ]
2012-08-06T17:17:48
2025-09-12T04:17:48
stinkycheeseman
false
CC BY-SA 4.0
11,832,950
360,705
46,147
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I'd like to round at most two decimal places, but only if necessary . Input: 10 1.7777777 9.1 Output: 10 1.78 9.1 How can I do this in JavaScript?
<p>I'd like to round at most two decimal places, but <em>only if necessary</em>.</p> <p>Input:</p> <pre><code>10 1.7777777 9.1 </code></pre> <p>Output:</p> <pre><code>10 1.78 9.1 </code></pre> <p>How can I do this in JavaScript?</p>
[ { "answerId": 11832950, "score": 5571, "isAccepted": true, "createdAt": "2012-08-06T17:20:31", "ownerDisplayName": "Brian Ustas", "ownerUserId": 1575238, "bodyText": "Use Math.round() : Math.round(num * 100) / 100 Or to be more specific and to ensure things like 1.005 round correctly, us...
2
1129216
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1129216/sort-array-of-objects-by-string-property-value
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,129,216
Sort array of objects by string property value
4,231
3,516,174
61
true
true
[ "javascript", "arrays", "sorting", "comparison", "array-of-dict" ]
2009-07-15T03:17:47
2025-11-09T09:41:53
Tyrone Slothrop
false
CC BY-SA 4.0
1,129,270
138,390
42,617
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I have an array of JavaScript objects: var objs = [ { first_nom: 'Laszlo', last_nom: 'Jamf' }, { first_nom: 'Pig', last_nom: 'Bodine' }, { first_nom: 'Pirate', last_nom: 'Prentice' } ]; How can I sort them by the value of last_nom in JavaScript? I know about sort(a,b) , but that only seems to work on strings and number...
<p>I have an array of JavaScript objects:</p> <pre><code>var objs = [ { first_nom: 'Laszlo', last_nom: 'Jamf' }, { first_nom: 'Pig', last_nom: 'Bodine' }, { first_nom: 'Pirate', last_nom: 'Prentice' } ]; </code></pre> <p>How can I sort them by the value of <code>last_nom</code> in JavaScript?</p> ...
[ { "answerId": 1129270, "score": 5804, "isAccepted": true, "createdAt": "2009-07-15T03:35:51", "ownerDisplayName": "Wogan", "ownerUserId": 137902, "bodyText": "It's easy enough to write your own comparison function: function compare( a, b ) { if ( a.last_nom < b.last_nom ){ return -1; } i...
1
784929
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/784929/what-does-the-double-exclamation-mark-operator-do-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
784,929
What does the !! (double exclamation mark) operator do in JavaScript?
4,219
987,769
37
true
true
[ "javascript", "operators" ]
2009-04-24T08:13:58
2024-11-18T17:24:27
Hexagon Theory
false
CC BY-SA 4.0
784,946
59,107
44,993
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I saw this code: this.vertical = vertical !== undefined ? !!vertical : this.vertical; It seems to be using !! as an operator, which I don't recognize. What does it do?
<p>I saw this code:</p> <pre class="lang-js prettyprint-override"><code>this.vertical = vertical !== undefined ? !!vertical : this.vertical; </code></pre> <p>It seems to be using <code>!!</code> as an operator, which I don't recognize. What does it do?</p>
[ { "answerId": 784946, "score": 3750, "isAccepted": true, "createdAt": "2009-04-24T08:18:07", "ownerDisplayName": "stevehipwell", "ownerUserId": 89075, "bodyText": "It converts Object to boolean . If it was falsy (e.g., 0 , null , undefined , etc.), it would be false , otherwise, true . !...
1
154059
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/154059/how-do-i-check-for-an-empty-undefined-null-string-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
154,059
How do I check for an empty/undefined/null string in JavaScript?
4,165
5,933,004
57
true
true
[ "javascript", "null", "is-empty" ]
2008-09-30T17:17:45
2025-11-18T20:37:43
casademora
false
CC BY-SA 4.0
154,068
5,619
70,207
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Is there a string.Empty in JavaScript, or is it just a case of checking for "" ?
<p>Is there a <code>string.Empty</code> in JavaScript, or is it just a case of checking for <code>&quot;&quot;</code>?</p>
[ { "answerId": 154068, "score": 5118, "isAccepted": true, "createdAt": "2008-09-30T17:20:14", "ownerDisplayName": "Brian Dukes", "ownerUserId": 2688, "bodyText": "Empty string, undefined, null, ... To check for a truthy value : if (strValue) { // strValue was non-empty string, true, 42, I...
1
1098040
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1098040/checking-if-a-key-exists-in-a-javascript-object
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,098,040
Checking if a key exists in a JavaScript object?
4,140
3,846,953
33
true
true
[ "javascript", "arrays", "object" ]
2009-07-08T13:21:32
2024-08-04T11:47:09
Adam Ernst
false
CC BY-SA 4.0
1,098,955
79
54,318
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I check if a particular key exists in a JavaScript object or array? If a key doesn't exist, and I try to access it, will it return false? Or throw an error?
<p>How do I check if a particular key exists in a JavaScript object or array?</p> <p>If a key doesn't exist, and I try to access it, will it return false? Or throw an error?</p>
[ { "answerId": 1098955, "score": 5620, "isAccepted": true, "createdAt": "2009-07-08T15:51:10", "ownerDisplayName": "Ateş Göral", "ownerUserId": 23501, "bodyText": "Checking for undefined-ness is not an accurate way of testing whether a key exists. What if the key exists but the value is a...
1
951021
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/951021/what-is-the-javascript-version-of-sleep
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
951,021
What is the JavaScript version of sleep()?
3,980
5,403,642
97
true
true
[ "javascript", "sleep" ]
2009-06-04T14:41:10
2025-10-22T19:19:24
fmsf
false
CC BY-SA 4.0
39,914,235
26,004
37,253
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Is there a better way to engineer a sleep in JavaScript than the following pausecomp function ? function pausecomp(millis) { var date = new Date(); var curDate = null; do { curDate = new Date(); } while(curDate-date < millis); } Unlike Sleep in JavaScript - delay between actions , I want a real sleep in the middle of a...
<p>Is there a better way to engineer a <code>sleep</code> in JavaScript than <a href="http://www.sean.co.uk/a/webdesign/javascriptdelay.shtm" rel="noreferrer">the following <code>pausecomp</code> function</a>?</p> <pre><code>function pausecomp(millis) { var date = new Date(); var curDate = null; do { curDat...
[ { "answerId": 39914235, "score": 5705, "isAccepted": true, "createdAt": "2016-10-07T09:44:56", "ownerDisplayName": "Dan Dascalescu", "ownerUserId": 1269037, "bodyText": "2017 — 2021 update Since 2009 when this question was asked, JavaScript has evolved significantly. All other answers ar...
1
679915
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
679,915
How do I test for an empty JavaScript object?
3,889
4,455,265
41
true
true
[ "javascript", "javascript-objects" ]
2009-03-25T01:39:45
2023-05-23T22:44:12
falmp
false
CC BY-SA 4.0
32,108,184
64,784
39,317
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
After an AJAX request, sometimes my application may return an empty object, like: var a = {}; How can I check whether that's the case?
<p>After an AJAX request, sometimes my application may return an empty object, like:</p> <pre><code>var a = {}; </code></pre> <p>How can I check whether that's the case?</p>
[ { "answerId": 32108184, "score": 7558, "isAccepted": true, "createdAt": "2015-08-20T01:32:52", "ownerDisplayName": "Adam Zerner", "ownerUserId": 1927876, "bodyText": "You can use a for…in loop with an Object.hasOwn ( ECMA 2022+ ) test to check whether an object has any own properties: fu...
1
1034621
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1034621/get-the-current-url-with-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,034,621
Get the current URL with JavaScript?
3,846
3,992,598
26
true
true
[ "javascript", "url" ]
2009-06-23T19:26:45
2026-03-12T17:52:17
dougoftheabaci
false
CC BY-SA 3.0
1,034,642
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
All I want is to get the website URL. Not the URL as taken from a link. On the page loading I need to be able to grab the full, current URL of the website and set it as a variable to do with as I please.
<p>All I want is to get the website URL. Not the URL as taken from a link. On the page loading I need to be able to grab the full, current URL of the website and set it as a variable to do with as I please.</p>
[ { "answerId": 1034642, "score": 4597, "isAccepted": true, "createdAt": "2009-06-23T19:29:00", "ownerDisplayName": "VolkerK", "ownerUserId": 4833, "bodyText": "Use: window.location.href As noted in the comments, the line below works, but breaks if you have a frame, image, or form with nam...
1
728360
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/728360/how-do-i-correctly-clone-a-javascript-object
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
728,360
How do I correctly clone a JavaScript object?
3,829
2,549,323
83
true
true
[ "javascript", "clone", "javascript-objects" ]
2009-04-08T03:01:06
2024-09-14T22:59:13
soundly_typed
true
null
728,694
49,695
40,642
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I have an object x . I'd like to copy it as object y , such that changes to y do not modify x . I realized that copying objects derived from built-in JavaScript objects will result in extra, unwanted properties. This isn't a problem, since I'm copying one of my own literal-constructed objects. How do I correctly clone ...
<p>I have an object <code>x</code>. I'd like to copy it as object <code>y</code>, such that changes to <code>y</code> do not modify <code>x</code>. I realized that copying objects derived from built-in JavaScript objects will result in extra, unwanted properties. This isn't a problem, since I'm copying one of my own li...
null
0
684672
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/684672/how-do-i-loop-through-or-enumerate-a-javascript-object
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
684,672
How do I loop through or enumerate a JavaScript object?
3,627
2,881,237
48
true
true
[ "javascript", "loops", "for-loop", "each" ]
2009-03-26T06:01:47
2022-12-09T10:25:44
Tanmoy
false
CC BY-SA 4.0
684,692
1,312,208
45,950
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I have a JavaScript object like the following: var p = { "p1": "value1", "p2": "value2", "p3": "value3" }; How do I loop through all of p 's elements ( p1 , p2 , p3 ...) and get their keys and values?
<p>I have a JavaScript object like the following:</p> <pre><code>var p = { &quot;p1&quot;: &quot;value1&quot;, &quot;p2&quot;: &quot;value2&quot;, &quot;p3&quot;: &quot;value3&quot; }; </code></pre> <p>How do I loop through all of <code>p</code>'s elements (<code>p1</code>, <code>p2</code>, <code>p3</code>....
[ { "answerId": 684692, "score": 5195, "isAccepted": true, "createdAt": "2009-03-26T06:12:13", "ownerDisplayName": "levik", "ownerUserId": 4465, "bodyText": "You can use the for-in loop as shown by others. However, you also have to make sure that the key you get is an actual property of an...
1
263965
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/263965/how-can-i-convert-a-string-to-boolean-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
263,965
How can I convert a string to boolean in JavaScript?
3,623
3,652,814
111
true
true
[ "javascript", "boolean-expression", "boolean-operations", "string-conversion" ]
2008-11-05T00:13:08
2025-07-20T08:49:01
Kevin
false
CC BY-SA 4.0
264,037
4,599
7,956
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Can I convert a string representing a boolean value (e.g., 'true', 'false') into an intrinsic type in JavaScript? I have a hidden form in HTML that is updated based on a user's selection within a list. This form contains some fields which represent boolean values and are dynamically populated with an intrinsic boolean ...
<p>Can I convert a string representing a boolean value (e.g., 'true', 'false') into an intrinsic type in JavaScript?</p> <p>I have a hidden form in HTML that is updated based on a user's selection within a list. This form contains some fields which represent boolean values and are dynamically populated with an intrinsi...
[ { "answerId": 264037, "score": 5093, "isAccepted": true, "createdAt": "2008-11-05T00:51:02", "ownerDisplayName": "guinaps", "ownerUserId": 27225, "bodyText": "Do: var isTrueSet = (myValue === 'true'); Use the strict equality operator ( === ), which doesn't make any implicit type conversi...
1
3552461
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/3552461/how-do-i-format-a-date-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
3,552,461
How do I format a date in JavaScript?
3,612
7,058,400
72
true
true
[ "javascript", "date", "datetime", "datetime-format", "date-formatting" ]
2010-08-23T23:28:26
2025-09-26T11:32:22
leora
false
CC BY-SA 4.0
3,552,493
4,653
198,465
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I format a Javascript Date object as a string? (Preferable format: 10-Aug-2010 )
<p>How do I format a Javascript <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date" rel="noreferrer"><code>Date</code></a> object as a string? (Preferable format: <code>10-Aug-2010</code>)</p>
[ { "answerId": 34015511, "score": 3087, "isAccepted": false, "createdAt": "2015-12-01T08:11:09", "ownerDisplayName": "ajeet kanojia", "ownerUserId": 4964277, "bodyText": "If you need slightly less control over formatting than the currently accepted answer, Date#toLocaleDateString can be u...
1
4810841
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/4810841/pretty-print-json-using-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
4,810,841
pretty-print JSON using JavaScript
3,556
2,015,666
32
true
true
[ "javascript", "json", "pretty-print" ]
2011-01-26T22:33:53
2024-03-08T23:47:49
Mark
false
CC BY-SA 4.0
7,220,510
298,406
70,530
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How can I display JSON in an easy-to-read (for human readers) format? I'm looking primarily for indentation and whitespace, with perhaps even colors / font-styles / etc.
<p>How can I display JSON in an easy-to-read (for human readers) format? I'm looking primarily for indentation and whitespace, with perhaps even colors / font-styles / etc.</p>
[ { "answerId": 7220510, "score": 6934, "isAccepted": true, "createdAt": "2011-08-28T10:56:51", "ownerDisplayName": "user123444555621", "ownerUserId": 27862, "bodyText": "Pretty-printing is implemented natively in JSON.stringify() . The third argument enables pretty printing and sets the s...
1
805107
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/805107/how-can-i-assign-a-multiline-string-literal-to-a-variable
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
805,107
How can I assign a multiline string literal to a variable?
3,522
2,469,249
41
true
true
[ "javascript", "string", "multiline", "heredoc" ]
2009-04-30T02:11:55
2024-11-30T20:59:45
Newy
false
CC BY-SA 4.0
805,113
95,956
40,327
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I convert this Ruby code with a multiline string into JavaScript? text = <<"HERE" This Is A Multiline String HERE
<p>How do I convert this Ruby code with a multiline string into JavaScript?</p> <pre class="lang-none prettyprint-override"><code>text = &lt;&lt;&quot;HERE&quot; This Is A Multiline String HERE </code></pre>
[ { "answerId": 805113, "score": 4558, "isAccepted": true, "createdAt": "2009-04-30T02:15:20", "ownerDisplayName": "Anonymous", "ownerUserId": 97408, "bodyText": "ECMAScript 6 (ES6) introduces a new type of literal, namely template literals . They have many features, variable interpolation...
1
1986896
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1986896/what-is-the-difference-between-call-and-apply
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,986,896
What is the difference between call and apply?
3,507
843,667
25
true
true
[ "javascript", "function", "performance" ]
2009-12-31T19:56:25
2024-10-26T11:54:02
John Duff
false
CC BY-SA 4.0
1,986,909
3,041
38,648
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
What is the difference between using Function.prototype.apply() and Function.prototype.call() to invoke a function? const func = function() { alert("Hello world!"); }; func.apply() vs. func.call() Are there performance differences between the two aforementioned methods? When is it best to use call over apply and vice v...
<p>What is the difference between using <code>Function.prototype.apply()</code> and <code>Function.prototype.call()</code> to invoke a function?</p> <pre class="lang-js prettyprint-override"><code>const func = function() { alert(&quot;Hello world!&quot;); }; </code></pre> <p><code>func.apply()</code> vs. <code>func...
[ { "answerId": 1986909, "score": 4047, "isAccepted": true, "createdAt": "2009-12-31T20:00:42", "ownerDisplayName": "flatline", "ownerUserId": 20846, "bodyText": "The difference is that apply lets you invoke the function with arguments as an array; call requires the parameters be listed ex...
1
195951
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/195951/how-can-i-change-an-elements-class-with-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
195,951
How can I change an element's class with JavaScript?
3,457
3,630,843
34
true
true
[ "javascript", "html", "dom" ]
2008-10-12T20:06:43
2024-08-13T09:02:43
Nathan Smith
false
CC BY-SA 4.0
196,038
4,998
37,687
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How can I change the class of an HTML element in response to an onclick or any other events using JavaScript?
<p>How can I change the class of an HTML element in response to an <code>onclick</code> or any other events using JavaScript?</p>
[ { "answerId": 196038, "score": 4678, "isAccepted": true, "createdAt": "2008-10-12T20:45:36", "ownerDisplayName": "Peter Boughton", "ownerUserId": 9360, "bodyText": "Modern HTML5 Techniques for changing classes Modern browsers have added classList which provides methods to make it easier ...
1
171251
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/171251/how-can-i-merge-properties-of-two-javascript-objects
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
171,251
How can I merge properties of two JavaScript objects?
3,378
2,119,028
69
true
true
[ "javascript", "javascript-objects" ]
2008-10-05T00:30:54
2024-09-17T04:16:14
JC Grubbs
false
CC BY-SA 4.0
171,256
4,541
40,591
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I need to be able to merge two (very simple) JavaScript objects at runtime. For example I'd like to: var obj1 = { food: 'pizza', car: 'ford' } var obj2 = { animal: 'dog' } obj1.merge(obj2); //obj1 now has three properties: food, car, and animal Is there a built in way to do this? I do not need recursion, and I do not n...
<p>I need to be able to merge two (very simple) JavaScript objects at runtime. For example I'd like to:</p> <pre><code>var obj1 = { food: 'pizza', car: 'ford' } var obj2 = { animal: 'dog' } obj1.merge(obj2); //obj1 now has three properties: food, car, and animal </code></pre> <p>Is there a built in way to do this? I ...
[ { "answerId": 171256, "score": 4198, "isAccepted": true, "createdAt": "2008-10-05T00:33:25", "ownerDisplayName": "John Millikin", "ownerUserId": 3560, "bodyText": "ECMAScript 2018 Standard Method You would use object spread : let merged = {...obj1, ...obj2}; merged is now the union of ob...
1
20035101
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/20035101/why-does-my-javascript-code-receive-a-no-access-control-allow-origin-header-i
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
20,035,101
Why does my JavaScript code receive a "No 'Access-Control-Allow-Origin' header is present on the requested resource" error, while Postman does not?
3,369
6,593,147
9
true
true
[ "javascript", "jquery", "cors", "postman", "same-origin-policy" ]
2013-11-17T19:29:06
2024-12-13T09:23:49
Mr Jedi
false
CC BY-SA 4.0
20,035,319
2,140,160
34,835
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Mod note : This question is about why XMLHttpRequest / fetch /etc. on the browser are subject to the Same Access Policy restrictions (you get errors mentioning CORB or CORS) while Postman is not. This question is not about how to fix a "No 'Access-Control-Allow-Origin'..." error. It's about why they happen. Please stop...
<blockquote> <p><strong>Mod note</strong>: This question is about why <code>XMLHttpRequest</code>/<code>fetch</code>/etc. on the browser are subject to the Same Access Policy restrictions (you get errors mentioning CORB or CORS) while Postman is not. This question is <strong>not</strong> about how to fix a &quot;No 'Ac...
null
0
4775722
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/4775722/how-can-i-check-if-an-object-is-an-array
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
4,775,722
How can I check if an object is an array?
3,361
2,120,656
51
true
true
[ "javascript", "arrays", "javascript-objects" ]
2011-01-23T18:53:04
2021-08-30T20:18:06
mpen
true
null
20,956,445
65,387
285,601
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I'm trying to write a function that either accepts a list of strings, or a single string. If it's a string, then I want to convert it to an array with just the one item so I can loop over it without fear of an error. So how do I check if the variable is an array?
<p>I'm trying to write a function that either accepts a list of strings, or a single string. If it's a string, then I want to convert it to an array with just the one item so I can loop over it without fear of an error.</p> <p>So how do I check if the variable is an array?</p>
null
0
37576685
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/37576685/using-async-await-with-a-foreach-loop
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
37,576,685
Using async/await with a forEach loop
3,353
2,479,589
35
true
true
[ "javascript", "node.js", "promise", "async-await", "ecmascript-2017" ]
2016-06-01T18:55:58
2025-01-28T01:27:13
Saad
false
CC BY-SA 4.0
37,576,787
3,533,365
55,029
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Are there any issues with using async / await in a forEach loop? I'm trying to loop through an array of files and await on the contents of each file. import fs from 'fs-promise' async function printFiles () { const files = await getFilePaths() // Assume this works fine files.forEach(async (file) => { const contents = a...
<p>Are there any issues with using <code>async</code>/<code>await</code> in a <code>forEach</code> loop? I'm trying to loop through an array of files and <code>await</code> on the contents of each file.</p> <pre><code>import fs from 'fs-promise' async function printFiles () { const files = await getFilePaths() // As...
[ { "answerId": 37576787, "score": 5807, "isAccepted": true, "createdAt": "2016-06-01T19:02:09", "ownerDisplayName": "Bergi", "ownerUserId": 1048572, "bodyText": "Sure the code does work, but I'm pretty sure it doesn't do what you expect it to do. It just fires off multiple asynchronous ca...
1
1357118
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1357118/event-preventdefault-vs-return-false
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,357,118
event.preventDefault() vs. return false
3,270
950,475
14
true
true
[ "javascript", "jquery", "event-handling", "dom-events", "event-propagation" ]
2009-08-31T11:58:31
2024-08-11T00:38:44
RaYell
false
CC BY-SA 4.0
1,357,151
137,467
70,660
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
When I want to prevent other event handlers from executing after a certain event is fired, I can use one of two techniques. I'll use jQuery in the examples, but this applies to plain-JS as well: 1. event.preventDefault() $('a').click(function (e) { // custom handling here e.preventDefault(); }); 2. return false $('a')....
<p>When I want to prevent other event handlers from executing after a certain event is fired, I can use one of two techniques. I'll use jQuery in the examples, but this applies to plain-JS as well:</p> <h3>1. <code>event.preventDefault()</code></h3> <pre><code>$('a').click(function (e) { // custom handling here ...
[ { "answerId": 1357151, "score": 2985, "isAccepted": true, "createdAt": "2009-08-31T12:05:19", "ownerDisplayName": "karim79", "ownerUserId": 70393, "bodyText": "return false from within a jQuery event handler is effectively the same as calling both e.preventDefault and e.stopPropagation o...
1
750486
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/750486/how-to-ensure-closures-created-in-a-loop-capture-the-value-of-the-loop-variable
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
750,486
How to ensure closures created in a loop capture the value of the loop variable from their particular iteration?
3,263
499,245
45
true
true
[ "javascript", "loops", "closures" ]
2009-04-15T06:06:20
2026-03-07T08:12:31
nickf
false
CC BY-SA 4.0
750,506
9,021
548,320
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
var funcs = []; // let's create 3 functions for (var i = 0; i < 3; i++) { // and store them in funcs funcs[i] = function() { // each should log its value. console.log("My value:", i); }; } for (var j = 0; j < 3; j++) { // and now let's run each one to see funcs[j](); } It outputs this: My value: 3 My value: 3 My value:...
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var funcs = []; // let's create 3 functions for (var i = 0; i &lt; 3; i++) { // and store them in funcs funcs[i] = function() ...
[ { "answerId": 750506, "score": 2405, "isAccepted": true, "createdAt": "2009-04-15T06:18:17", "ownerDisplayName": "harto", "ownerUserId": 86463, "bodyText": "Well, the problem is that the variable i , within each of your anonymous functions, is bound to the same variable outside of the fu...
1
27509
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/27509/detecting-an-undefined-object-property
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
27,509
Detecting an undefined object property
3,247
1,530,702
49
true
true
[ "javascript", "object", "undefined", "object-property" ]
2008-08-26T07:25:08
2023-08-21T11:42:18
Matt Sheppard
false
CC BY-SA 4.0
416,327
797
118,363
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I check if an object property in JavaScript is undefined?
<p>How do I check if an object property in JavaScript is undefined?</p>
[ { "answerId": 416327, "score": 2957, "isAccepted": true, "createdAt": "2009-01-06T12:27:41", "ownerDisplayName": "Erwin", "ownerUserId": null, "bodyText": "The usual way to check if the value of a property is the special value undefined , is: if(o.myProperty === undefined) { alert(\"myPr...
1
23569441
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/23569441/is-it-possible-to-apply-css-to-half-of-a-character
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
23,569,441
Is it possible to apply CSS to half of a character?
3,194
300,851
20
true
true
[ "javascript", "html", "css" ]
2014-05-09T16:16:57
2025-10-13T13:30:39
SimplyAzuma
false
CC BY-SA 4.0
23,569,891
3,009,513
25,654
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
What I am looking for: A way to style one HALF of a character. (In this case, half the letter being transparent) What I have currently searched for and tried (With no luck): Methods for styling half of a character/letter Styling part of a character with CSS or JavaScript Apply CSS to 50% of a character Below is an exam...
<p><strong>What I am looking for:</strong></p> <p>A way to style one <strong>HALF</strong> of a character. (In this case, half the letter being transparent)</p> <p><strong>What I have currently searched for and tried (With no luck):</strong></p> <ul> <li>Methods for styling half of a character/letter</li> <li>Styling p...
[ { "answerId": 23569891, "score": 3159, "isAccepted": true, "createdAt": "2014-05-09T16:42:23", "ownerDisplayName": "Arbel", "ownerUserId": 2210457, "bodyText": "Now on GitHub as a Plugin! Feel free to fork and improve. Demo | Download Zip | Half-Style.com (Redirects to GitHub) Pure CSS f...
1
31044
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/31044/is-there-an-exists-function-for-jquery
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
31,044
Is there an "exists" function for jQuery?
3,165
879,462
17
true
true
[ "javascript", "jquery" ]
2008-08-27T19:49:41
2024-10-05T06:32:55
Jake McGraw
false
CC BY-SA 3.0
587,408
302
56,196
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How can I check the existence of an element in jQuery? The current code that I have is this: if ($(selector).length > 0) { // Do something } Is there a more elegant way to approach this? Perhaps a plugin or a function?
<p>How can I check the existence of an element in jQuery?</p> <p>The current code that I have is this:</p> <pre><code>if ($(selector).length &gt; 0) { // Do something } </code></pre> <p>Is there a more elegant way to approach this? Perhaps a plugin or a function?</p>
[ { "answerId": 587408, "score": 2776, "isAccepted": true, "createdAt": "2009-02-25T19:16:21", "ownerDisplayName": "Tim Büthe", "ownerUserId": 60518, "bodyText": "In JavaScript, everything is 'truthy' or 'falsy', and for numbers 0 means false , everything else true . So you could write: if...
1
5515310
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/5515310/is-there-a-standard-function-to-check-for-null-undefined-or-blank-variables-in
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
5,515,310
Is there a standard function to check for null, undefined, or blank variables in JavaScript?
3,148
3,148,526
47
true
true
[ "javascript", "null", "comparison", "undefined" ]
2011-04-01T15:14:24
2024-03-07T12:44:58
Alex
true
null
5,515,349
177,416
36,099
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Is there a universal JavaScript function that checks that a variable has a value and ensures that it's not undefined or null ? I've got this code, but I'm not sure if it covers all cases: function isEmpty(val){ return (val === undefined || val == null || val.length <= 0) ? true : false; }
<p>Is there a universal JavaScript function that checks that a variable has a value and ensures that it's not <code>undefined</code> or <code>null</code>? I've got this code, but I'm not sure if it covers all cases:</p> <pre><code>function isEmpty(val){ return (val === undefined || val == null || val.length &lt;= 0...
[ { "answerId": 5515349, "score": 5791, "isAccepted": true, "createdAt": "2011-04-01T15:17:44", "ownerDisplayName": "jAndy", "ownerUserId": 1386886, "bodyText": "You can just check if the variable has a truthy value or not. That means if (value) { // do something.. } will evaluate to true ...
1
4351521
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/4351521/how-do-i-pass-command-line-arguments-to-a-node-js-program-and-receive-them
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
4,351,521
How do I pass command line arguments to a Node.js program and receive them?
3,147
1,978,360
42
true
true
[ "javascript", "node.js", "arguments", "command-line-arguments" ]
2010-12-04T01:56:46
2025-03-04T17:54:34
milkplus
false
CC BY-SA 4.0
4,351,548
245,777
34,575
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I have a web server written in Node.js and I would like to launch with a specific folder. I'm not sure how to access arguments in JavaScript. I'm running node like this: $ node server.js folder here server.js is my server code. Node.js help says this is possible: $ node -h Usage: node [options] script.js [arguments] Ho...
<p>I have a web server written in <a href="http://en.wikipedia.org/wiki/Node.js" rel="noreferrer">Node.js</a> and I would like to launch with a specific folder. I'm not sure how to access arguments in JavaScript. I'm running node like this:</p> <pre><code>$ node server.js folder </code></pre> <p>here <code>server.js<...
[ { "answerId": 4351548, "score": 3780, "isAccepted": true, "createdAt": "2010-12-04T02:05:32", "ownerDisplayName": "MooGoo", "ownerUserId": 375394, "bodyText": "Standard Method (no library) The arguments are stored in process.argv Here are the node docs on handling command line args: proc...
1
3390396
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/3390396/how-can-i-check-for-undefined-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
3,390,396
How can I check for "undefined" in JavaScript?
3,108
3,811,947
16
true
true
[ "javascript", "undefined" ]
2010-08-02T17:53:29
2020-07-24T23:25:26
makerofthings7
true
null
3,390,426
328,397
61,839
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
What is the most appropriate way to test if a variable is undefined in JavaScript? I've seen several possible ways: if (window.myVariable) Or if (typeof(myVariable) != "undefined") Or if (myVariable) // This throws an error if undefined. Should this be in Try/Catch?
<p>What is the most appropriate way to test if a variable is undefined in JavaScript?</p> <p>I've seen several possible ways:</p> <pre><code>if (window.myVariable) </code></pre> <p>Or</p> <pre><code>if (typeof(myVariable) != &quot;undefined&quot;) </code></pre> <p>Or</p> <pre><code>if (myVariable) // This throws an err...
[ { "answerId": 3390426, "score": 3239, "isAccepted": true, "createdAt": "2010-08-02T17:58:18", "ownerDisplayName": "Anurag", "ownerUserId": 165737, "bodyText": "If you are interested in finding out whether a variable has been declared regardless of its value, then using the in operator is...
1
2010892
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/2010892/how-to-store-objects-in-html5-localstorage-sessionstorage
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
2,010,892
How to store objects in HTML5 localStorage/sessionStorage
3,103
1,499,516
24
true
true
[ "javascript", "html", "local-storage" ]
2010-01-06T04:05:51
2023-10-11T19:44:18
Kristopher Johnson
false
CC BY-SA 4.0
2,010,948
1,175
82,794
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I'd like to store a JavaScript object in HTML5 localStorage , but my object is apparently being converted to a string. I can store and retrieve primitive JavaScript types and arrays using localStorage , but objects don't seem to work. Should they? Here's my code: var testObject = { 'one': 1, 'two': 2, 'three': 3 }; con...
<p>I'd like to store a JavaScript object in HTML5 <code>localStorage</code>, but my object is apparently being converted to a string.</p> <p>I can store and retrieve primitive JavaScript types and arrays using <code>localStorage</code>, but objects don't seem to work. Should they?</p> <p>Here's my code:</p> <pre><code...
[ { "answerId": 2010948, "score": 3821, "isAccepted": true, "createdAt": "2010-01-06T04:25:58", "ownerDisplayName": "Christian C. Salvadó", "ownerUserId": 5445, "bodyText": "Looking at the Apple , Mozilla and Mozilla again documentation, the functionality seems to be limited to handle only...
1
824349
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/824349/how-do-i-modify-the-url-without-reloading-the-page
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
824,349
How do I modify the URL without reloading the page?
3,084
2,206,706
22
true
true
[ "javascript", "html", "url", "url-rewriting", "friendly-url" ]
2009-05-05T10:54:05
2025-08-04T09:15:58
Robin Rodricks
false
CC BY-SA 4.0
3,354,511
41,021
114,730
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Is there a way I can modify the URL of the current page without reloading the page? I would like to access the portion before the # hash if possible. I only need to change the portion after the domain, so it's not like I'm violating cross-domain policies. window.location.href = "www.mysite.com/page2.php"; // this reloa...
<p>Is there a way I can modify the URL of the current page without reloading the page?</p> <p>I would like to access the portion <strong>before</strong> the # hash if possible.</p> <p>I only need to change the portion <strong>after</strong> the domain, so it's not like I'm violating cross-domain policies.</p> <pre><cod...
[ { "answerId": 3354511, "score": 2467, "isAccepted": true, "createdAt": "2010-07-28T15:30:31", "ownerDisplayName": "David Murdoch", "ownerUserId": 160173, "bodyText": "This can now be done in Chrome, Safari, Firefox 4+, and Internet Explorer 10pp4+! See this question's answer for more inf...
1
5223
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/5223/length-of-a-javascript-object
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
5,223
Length of a JavaScript object
3,082
3,111,344
43
true
true
[ "javascript", "object", "javascript-objects" ]
2008-08-07T19:42:21
2025-02-01T19:20:27
Gareth Simpson
false
CC BY-SA 4.0
6,700
147
37,851
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I have a JavaScript object. Is there a built-in or accepted best practice way to get the length of this object? const myObject = new Object(); myObject["firstname"] = "Gareth"; myObject["lastname"] = "Simpson"; myObject["age"] = 21;
<p>I have a JavaScript object. Is there a built-in or accepted best practice way to get the length of this object?</p> <pre><code>const myObject = new Object(); myObject[&quot;firstname&quot;] = &quot;Gareth&quot;; myObject[&quot;lastname&quot;] = &quot;Simpson&quot;; myObject[&quot;age&quot;] = 21; </code></pre>
[ { "answerId": 6700, "score": 3474, "isAccepted": true, "createdAt": "2008-08-09T08:31:04", "ownerDisplayName": "James Coglan", "ownerUserId": null, "bodyText": "Updated answer Here's an update as of 2016 and widespread deployment of ES5 and beyond. For IE9+ and all other modern ES5+ capa...
1
596351
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/596351/how-can-i-know-which-radio-button-is-selected-via-jquery
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
596,351
How can I know which radio button is selected via jQuery?
3,080
2,557,731
39
true
true
[ "javascript", "jquery", "html", "jquery-selectors", "radio-button" ]
2009-02-27T19:53:27
2022-09-13T05:12:25
juan
false
CC BY-SA 4.0
596,369
1,782
82,342
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I have two radio buttons and want to post the value of the selected one. How can I get the value with jQuery? I can get all of them like this: $("form :radio") How do I know which one is selected?
<p>I have two radio buttons and want to post the value of the selected one. How can I get the value with jQuery?</p> <p>I can get all of them like this:</p> <pre><code>$("form :radio") </code></pre> <p>How do I know which one is selected?</p>
[ { "answerId": 596369, "score": 4306, "isAccepted": true, "createdAt": "2009-02-27T19:58:39", "ownerDisplayName": "Peter J", "ownerUserId": 56018, "bodyText": "To get the value of the selected radioName item of a form with id myForm : $('input[name=radioName]:checked', '#myForm').val() He...
1
1531093
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/1531093/how-do-i-get-the-current-date-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
1,531,093
How do I get the current date in JavaScript?
3,049
4,381,054
64
true
true
[ "javascript", "date", "date-formatting" ]
2009-10-07T11:39:02
2026-03-27T21:23:24
Suresh
false
CC BY-SA 4.0
4,929,629
96,180
39,657
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do I get the current date in JavaScript?
<p>How do I get the current date in JavaScript?</p>
[ { "answerId": 4929629, "score": 3473, "isAccepted": true, "createdAt": "2011-02-08T04:42:59", "ownerDisplayName": "Samuel Meddows", "ownerUserId": 525895, "bodyText": "Use new Date() to generate a new Date object containing the current date and time. var today = new Date(); var dd = Stri...
1
152975
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/152975/how-do-i-detect-a-click-outside-an-element
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
152,975
How do I detect a click outside an element?
2,975
1,844,863
91
true
true
[ "javascript", "jquery", "click" ]
2008-09-30T13:17:12
2023-03-27T23:51:46
Sergio del Amo
false
CC BY-SA 4.0
153,047
2,138
78,336
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I have some HTML menus, which I show completely when a user clicks on the head of these menus. I would like to hide these elements when the user clicks outside the menus' area. Is something like this possible with jQuery? $("#menuscontainer").clickOutsideThisElement(function() { // Hide the menus });
<p>I have some HTML menus, which I show completely when a user clicks on the head of these menus. I would like to hide these elements when the user clicks outside the menus' area.</p> <p>Is something like this possible with jQuery?</p> <pre><code>$("#menuscontainer").clickOutsideThisElement(function() { // Hide t...
null
0
4907843
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/4907843/open-a-url-in-a-new-tab-and-not-a-new-window
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
4,907,843
Open a URL in a new tab (and not a new window)
2,951
4,063,271
32
true
true
[ "javascript", "tabs", "href" ]
2011-02-05T15:52:13
2024-12-20T11:10:45
Mark
false
CC BY-SA 4.0
4,907,854
137,100
41,523
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
I'm trying to open a URL in a new tab, as opposed to a popup window. I've seen related questions where the responses would look something like: window.open(url,'_blank'); window.open(url); But none of them worked for me, the browser still tried to open a popup window.
<p>I'm trying to open a <a href="https://en.wikipedia.org/wiki/URL" rel="noreferrer">URL</a> in a new tab, as opposed to a popup window.</p> <p>I've seen related questions where the responses would look something like:</p> <pre><code>window.open(url,'_blank'); window.open(url); </code></pre> <p>But none of them work...
[ { "answerId": 11384018, "score": 2681, "isAccepted": false, "createdAt": "2012-07-08T14:49:56", "ownerDisplayName": "Duke", "ownerUserId": 510754, "bodyText": "This is a trick, function openInNewTab(url) { window.open(url, '_blank').focus(); } // Or just window.open(url, '_blank').focus(...
1
332872
question
stackoverflow
2026-08-03T01:37:30
null
null
null
null
null
https://stackoverflow.com/questions/332872/encode-url-in-javascript
gRfaNe5dFEERAlPiJ
OOGxFG8S0YK0PA8Ta
332,872
Encode URL in JavaScript
2,939
2,020,088
22
true
true
[ "javascript", "url", "encode", "urlencode" ]
2008-12-02T02:37:08
2024-01-12T21:20:18
nickf
false
CC BY-SA 4.0
332,888
9,021
548,320
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
How do you safely encode a URL using JavaScript such that it can be put into a GET string? var myUrl = "http://example.com/index.html?param=1&anotherParam=2"; var myOtherUrl = "http://example.com/index.html?url=" + myUrl; I assume that you need to encode the myUrl variable on that second line?
<p>How do you safely encode a URL using JavaScript such that it can be put into a GET string?</p> <pre><code>var myUrl = "http://example.com/index.html?param=1&amp;anotherParam=2"; var myOtherUrl = "http://example.com/index.html?url=" + myUrl; </code></pre> <p>I assume that you need to encode the <code>myUrl</code> v...
[ { "answerId": 332888, "score": 3239, "isAccepted": true, "createdAt": "2008-12-02T02:43:57", "ownerDisplayName": "Buu", "ownerUserId": 17815, "bodyText": "Check out the built-in function encodeURIComponent(str) and encodeURI(str) . In your case, this should work: var myOtherUrl = \"http:...
1