Solved

lint warning: block statement without curly braces

Posted on 2014-11-28
1
246 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 74

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

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.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now