Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any line limitation in javascript?

Tags:

javascript

is there any limitation on number of lines a javascript file can have?

like image 324
rajakvk Avatar asked Apr 21 '11 14:04

rajakvk


People also ask

What is the recommended length limit for a line of code?

GitHub is the de facto coding standard 125 characters per line is the real de facto coding standard for maximum line length these days, because this is the maximum number of characters that you can see in the GitHub diff view.

How long should lines be in HTML?

Line FormattingYou should not have any lines that are longer than 100 characters in your HTML code. When any line is longer than 100 characters, break it apart into multiple lines.

Does JavaScript size matter?

Like any other file building a web page, JavaScript needs to load before it can function. The size of JavaScript files along with the way these files are delivered both affect the load time.


2 Answers

10121 / 8

Since 10121 is the maximum number of bits in the universe and presumably you would do 8-bit encoding of your javascript, then even if the whole universe was filled with nothing else then your blank javascript file there could be no more then 11.25e120 lines in it.

TL;DR No there is no limit.

like image 142
Jakub Hampl Avatar answered Oct 06 '22 23:10

Jakub Hampl


Nothing official, but the larger the file, the more the browser needs to download, parse and execute.

In fact, a common practice it to join multiple javascript files into one so only one browser connection gets tied up with downloading javascript. This is normally part of minification (which can include other steps such as renaming variables to short ones, removing whitespace etc...).

like image 41
Oded Avatar answered Oct 07 '22 00:10

Oded