What is the significance of, and the reason for, wrapping the entire content of a JavaScript source file in a function block?

Asked by Last Modified  

1 Answer

+3 Angular.JS

Follow 1
Answer

Please enter your answer

In javascript, only functions create local scope. It is possible you may accidently declare variables with same name as being used on other libraries or your own code cause errnaneous results in your code or third party code. To avoid such global scope pollution, it is recommended to enclose your code...
read more
In javascript, only functions create local scope. It is possible you may accidently declare variables with same name as being used on other libraries or your own code cause errnaneous results in your code or third party code. To avoid such global scope pollution, it is recommended to enclose your code in IIF (Immediatly invoked functions) or also called Self Invoking Functions, you can avoid global scope issues. read less
Comments

Related Questions

How do I do web design?
Plan Your Website. Choose the Right Website Platform. Customize the Web Design. Set Up the Essential Pages. Optimize for the User Experience. Make Your Website Mobile-Friendly. Test Your Website...
Ujwalajagdale
0 0
5
Is it better to be a Web Designer or Web Developer?
Developers tend to make more money than web designers because they need more technical skills
Asif
0 0
7
Want to do internship and learn web development (JS+PHP). With exposure to lve projects. Free internship
you can join my training institute , which is provide to corporate level expert training with placement guarantee in php course.
Rahul

I am working as a WordPress developer from 2 years. But from beginning to till now I am working on the same things, what should I learn now to grow my career?

As you are working on Wordpress since years you might have worked for many websites in these years, so it'll be great for you to learn Advanced Digital Marketing which can help your career to grow next level.
Yogesh
Where is best training center for web development in Bangalore?
Hi, You can learn Web Development at PracticalCoding.in with an experienced developer as a personal mentor sitting right at your home at INR1500/week.
Harsh

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

5 Tips On How To Become A Web Developer
1. Have A Goal: Always first decide what you want to create. 2. Learn To Code : You should be passinate about coding. As you know practice makes a Man Perfect. 3. Google for Solutions : Someone once...

Why Angularjs Is Highly Popular?
AngularJS is a full-fledged JavaScript framework. It has made the life of JavaScript developers very easy. It provides some amazing features which were not present in any of the single JS framework ever....

What Is Web Designing Or Composition?
What is web Designing or composition? Quickly, web designing implies arranging, creation and refreshing of websites. Web composition likewise includes data engineering, site structure, UI, route ergonomics,...

Things to learn in Python before choosing any Technological Vertical
Day 1: Python Basics Objective: Understand the fundamentals of Python programming language. Variables and Data Types (Integers, Strings, Floats, Booleans) Basic Input and Output (using input()...

Why Should Every Student Should Posses A Digital Resume?
Did you know that 80% of employers will Google you before an interview according to a recent article by job search expert Susan Joyce? What are they going to find? Is this potential employer going to...

Recommended Articles

Today, no business can exist without having its own website to interact with its customer base. Having a website is no more restricted to the big MNCs. With the advancement in technology and global business, even the small enterprises are spending on having their own websites and development teams. The person works on web...

Read full article >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

Read full article >

Hadoop is a framework which has been developed for organizing and analysing big chunks of data for a business. Suppose you have a file larger than your system’s storage capacity and you can’t store it. Hadoop helps in storing bigger files than what could be stored on one particular server. You can therefore store very,...

Read full article >

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

Read full article >

Looking for Web Development Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you