Cannot assign to read only property ‘$methodName’ of false Use –force to continue

One receives this error with Grunt, AngularJS if the grunt-ng-annotate is out of date.

Open your project.js and remove the grunt-ng-annotate, most of the time it is an old edition like 0.4.0. save an push to your server if you are remote.

Then on the server reinstall your grunt-ng-annotate

CODE – Javascript Function format as currency

Simple Format as currency in American dollars $. formatCurrency(number) you can modify the regExpression to make this work for other currencty formats.

CODE – Javascript how to spell check a live website.

Requirements: FireFox

If you maintain a website, you will surely know how important it is to never have any spelling errors in your copy. And if you really care you will always run for sure a spell checker on all your text, but isn’t that quite over work? Wouldn’t it be much simpler if your browser did all the spell checking without you having to worry about anything?

Well, there is a very simple way of doing so, simply copy the following javascript code and paste it into the address bar:

CODE – Javascript Function right

Simple JavaScript function Right(string,number)

CODE – Javascript Function create, store and delete a cookie

In this example we will create a cookie that stores the name of a visitor. The first time a visitor arrives to the web page, he or she will be asked to fill in her/his name. The name is then stored in a cookie. The next time the visitor arrives at the same page, he or she will get welcome message.

First, we create a function that stores the name of the visitor in a cookie variable:

The parameters of the function above hold the name of the cookie, the value of the cookie, and the number of days until the cookie expires.

In the function above we first convert the number of days to a valid date, then we add the number of days until the cookie should expire. After that we store the cookie name, cookie value and the expiration date in the document.cookie object.

Then, we create another function that checks if the cookie has been set:

The function above first checks if a cookie is stored at all in the document.cookie object. If the document.cookie object holds some cookies, then check to see if our specific cookie is stored. If our cookie is found, then return the value, if not – return an empty string.

Last, we create the function that displays a welcome message if the cookie is set, and if the cookie is not set it will display a prompt box, asking for the name of the user:

How to Delete a cookie.

CODE – JavaScript Function isNumeric() function

A simple isNumeric function for JavaScript that allows scientific notations. You could always modify the RegExp to be /^(-)?(\d*)(\.?)(\d*)$/ for simple numbers like -123.00