Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by Norton Alex
at 2025-02-01 21:15:33
Point:500 Replies:2 POST_ID:829294USER_ID:12423
Topic:
javascript
I have seen a lot javascript file whcih starting with "!" character before function
What is the purpose of that ?
For example;
!function(x){a=x}()
Please advise
Accepted Solution
Expert: Wilson Edwards replied at 2025-02-01 21:21:10
500 points Excellent
Reference:
Expert: Wilson Edwards replied at 2025-02-01 21:19:31
! is the boolean not operator, which you probably know. Calling a function results in a value (in this case undefined). The side effect still happens, so a will be assigned 7, but then nothing happens. You can rewrite it like this:a = x;!undefined!undefined is true, but since it isn't used at all, it won't matter.