Javascript formatting opinion: cons

When searching for jquery examples, I see that authors typically have an “or” to enclose, for example, a selector.

How in:

$ ('# tags'). Click ...

or

$ ("# tags"). Click

Is it a personal style, or is there a reason why one is better than the other?

In my brief experience, I found that “typing is faster. Also, creating json parameters is easier with“ because you can easily escape ”in strings.

+3
source share
7 answers

Javascript . , HTML/XML " ". Javascript, , onclick. javascript . , "." Javascript ", ".

+5

Python ( ), , , - " " ( ) - , ;-). , ( , "O'Brian" , , SQL-, "SELECT foo FROM bar WHERE baz='zapzap'").

+2

Javascript - -, , PHP. , , .

JSON, , . , JSON 100% - Javascript - Javascript, .

, .

,

{ foo : 'bar' }

Javascript, JSON. JSON

{ "foo" : "bar" }
+2

java-, " " ( 1).

+1

PHP. , , . , "". JS, , .

+1

"" - , " ", escape-. Vice Versa, , ".

0

, , . , VB6 Octave Agena ( ), , . ,

T "CACos", CACos(CReset(-P_I, 2)), CParse(script("octave", str.Subst("printf(""%s"",num2str(acos(complex([1],[2]))));", -P_I, 2)))

Javascript, .

0

Source: https://habr.com/ru/post/1709780/


All Articles