What is the meaning of the dot?
The dot signifies that we want to use something that’s inside something else.
console.log("log is inside of a console");
myObject.search("Tony de Araujo");
// search is a method which is inside of object myObject
Hope it helps!
What is AngularJS?
AngulatJS is a new way of scripting the HTML DOM.
AngularJS is a framework. All you have to do is link your web page to Google’s content distribution network (CDN) and your HTML becomes supercharged with many utilities you can use to make it more dynamic.
Hi dear reader,
you’ll be pleased to know that I have converted the project into AngularJS.
AngularJS was not even mentioned in the book but I figured it was time to demonstrate a way of implementing AngularJS on the script and it is a cool implementation as you may see on the following link:
In order to expand my support for those reading my publications at Amazon I have created a new site where each book exercise is being further explored.
The night is still young but I’m working at it countless hours a day.
Please visit: jsplain.com
In order to avoid conflicts of interests it is always a good idea to keep variable names unique.
Avoiding name duplication is easy to do in a simple demo script but in real life it is not so easy. Actually it is virtually impossible because code comes from different sources, the ones we write ourselves and the ones provided by applications we link to.
What we can do to prevent such conflict of interest is to isolate our own code into a closed circuit. This type of implementation if called encapsulation.
There are many ways of applying encapsulation. One such way is to include our code inside of a function. Another way is to write it as an object.
- A function has its own scope which protects its declared assets from being mistaken by global items with the same name.
- As for items inside of objects, they require proper addressing whenever we want to use them. That in itself prevents us from calling the wrong global item by mistake.
I show a few simple encapsulation examples on my latest post at jsplain.com.
A JSON and AngularJS Prep
Is now available on Amazon.
Thank you for your amazing feedback!
Please click on the image to read more about it.
It may not be something to do all the time but for that particular occasion where it will make a difference here it is the recipe:
console.log("%cHello World!", "color: red; font-family: Verdana");
It outputs Hello World!
What about a multicolor output?
console.log("%cHello %cWorld!", "color: red; font-family: Verdana","color: blue; font-style: italic");
It outputs Hello World!
The secrete is in the %c which serves as a placeholder for the style that follows as the second or third arguments.