Solved

lint warning: block statement without curly braces

Posted on 2014-11-28
1
254 Views
Last Modified: 2014-11-28
I'm getting this error for line 2:

	if(typeof place_id=="undefined")
		place_id = null;

Open in new window

0
Comment
Question by:seopti
1 Comment
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 40471033
Your code is legal but it's not a best practice. The reason is that sometimes people can overlook that the if is actually a single line. Someone coming behind you might try to add an additional line, thinking it will be executed along with the if, but it will not. Best practice is to include braces around the things that belong to the if, even if they are only one line.

e.g.

if(typeof place_id=="undefined")
{
    place_id = null;
}

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Using jQuery to set a DIV attribute on page load 9 33
Why doesn't Google directions work? 6 47
Jquery keyup 4 20
why $(this).attr('id'); function not returning value ? 9 42
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question