Thursday, December 16, 2021
JavaScript does not have a built-in feature to define a namespace. A namespace is basically a container of your code that it does not pollute the other codes that's on page. Namespace allows you to play nice with people's code and other JavaScript libraries.
Fortunately, JavaScript functions have their own contexts and scope. Therefore, we can use functions as a namespace so that it does not pollute the global scope.
The easiest way to create a namespace on a page is to encapsulate everything in an anonymous function like the code below.
Another way of using namespace is to assign the anonymous function to a variable
Fortunately, JavaScript functions have their own contexts and scope. Therefore, we can use functions as a namespace so that it does not pollute the global scope.
The easiest way to create a namespace on a page is to encapsulate everything in an anonymous function like the code below.
<script> (function () { // put your code here }()); </script>
Another way of using namespace is to assign the anonymous function to a variable
<script> var myNameSpace = (function () { // put your code here }()); </script>
Subscribe to:
Post Comments (Atom)
Search This Blog
Tags
Web Development
Linux
Javascript
DATA
CentOS
ASPNET
SQL Server
Cloud Computing
ASP.NET Core
ASP.NET MVC
SQL
Virtualization
AWS
Database
ADO.NET
AngularJS
C#
CSS
EC2
Iaas
System Administrator
Azure
Computer Programming
JQuery
Coding
ASP.NET MVC 5
Entity Framework Core
Web Design
Infrastructure
Networking
Visual Studio
Errors
T-SQL
Ubuntu
Stored Procedures
ACME Bank
Bootstrap
Computer Networking
Entity Framework
Load Balancer
MongoDB
NoSQL
Node.js
Oracle
VirtualBox
Container
Docker
Fedora
Java
Source Control
git
ExpressJS
MySQL
NuGet
Blogger
Blogging
Bower.js
Data Science
JSON
JavaEE
Web Api
DBMS
DevOps
HTML5
MVC
SPA
Storage
github
AJAX
Big Data
Design Pattern
Eclipse IDE
Elastic IP
GIMP
Graphics Design
Heroku
Linux Mint
Postman
R
SSL
Security
Visual Studio Code
ASP.NET MVC 4
CLI
Linux Commands
Powershell
Python
Server
Software Development
Subnets
Telerik
VPC
Windows Server 2016
angular-seed
font-awesome
log4net
servlets
tomcat
AWS CloudWatch
Active Directory
Angular
Blockchain
Collections
Compatibility
Cryptocurrency
DIgital Life
DNS
Downloads
Google Blogger
Google Chrome
Google Fonts
Hadoop
IAM
KnockoutJS
LINQ
Linux Performance
Logging
Mobile-First
Open Source
Prototype
R Programming
Responsive
Route 53
S3
SELinux
Software
Unix
View
Web Forms
WildFly
XML
cshtml
githu
If you require help with an iPhone repair or a Samsung repair please feel free to connect with us at the link below. Teck Repair is an expert in screen repair services in Swindon UK
ReplyDeletehttps://teck.repair/samsung-galaxy-note-10-repair-swindon/
After Gradution Your guide to our exporters is the Online Career Counsellin in Delhi Fees export for your guides save future
ReplyDeletehttps://www.jitinchawla.com/blog/here-is-why-you-should-study-in-the-netherlands
Tapouts combine the power of search and social optimised by our unique (DNA) Digital Network Algorithms.
ReplyDeleteAs a Digital Marketing Company we can enable services to support your reputation management.
We also provide premium support services required for your Digital Marketing Needs.