M
M
Maxim Dunayevsky2014-10-01 15:46:05
JavaScript
Maxim Dunayevsky, 2014-10-01 15:46:05

Why in Twitter Bootstrap + before function declarations?

Hello!
Looked at Twitter Bootstrap sources, got to bootstrap.js. What surprised me was the use of the "+" sign before declaring anonymous functions. In addition, the entire code is stubbed "use strict", and there are few places after the operators with a semicolon.
Actually, two questions:
- why is there a "+" sign?
- why do developers almost never use a semicolon after assignment, function calls and return statements? Is this good JS programming practice?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Dunayevsky, 2014-10-01
@dunmaksim

It is clear from the article that this is another way of declaring a self-calling function. A very interesting approach.

R
Rrooom, 2014-10-01
@Rrooom

Didn't look at the source. But:
+ - standard reduction to a number, you can see you need
Absence of a semicolon - they are crooked. Well, or you exaggerate - according to the standards, it is not necessary to put a semicolon everywhere.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question