JavaScript string encryption and decryption?

I’m interested in building a small app for personal use that will encrypt and decrypt information on the client side using JavaScript. The encrypted information will be stored in a database on a server, but never the decrypted version. It doesn’t have to be super duper secure, but I would like to use a currently … Read more

What is the equivalent of Java’s System.out.println() in Javascript?

Essentially console.log(“Put a message here.”) if the browser has a supporting console. Another typical debugging method is using alerts, alert(“Put a message here.”) RE: Update II This seems to make sense, you are trying to automate QUnit tests, from what I have read on QUnit this is an in-browser unit testing suite/library. QUnit expects to … Read more

parsing JSONP $http.jsonp() response in angular.js

UPDATE: since Angular 1.6 You can no longer use the JSON_CALLBACK string as a placeholder for specifying where the callback parameter value should go You must now define the callback like so: $http.jsonp(‘some/trusted/url’, {jsonpCallbackParam: ‘callback’}) Change/access/declare param via $http.defaults.jsonpCallbackParam, defaults to callback Note: You must also make sure your URL is added to the trusted/whitelist: $sceDelegateProvider.resourceUrlWhitelist or … Read more

javascript push multidimensional array

Arrays must have zero based integer indexes in JavaScript. So: Or maybe you want to use objects (which are associative arrays): which is equivalent to: It’s a really fundamental and crucial difference between JavaScript arrays and JavaScript objects (which are associative arrays) that every JavaScript developer must understand.

Angular 2 Sort table columns

I assume you are loading the data (selectedData) for this template asynchronously in the component’s class, so at the start it’s not yet returned form the service, hence selectedData = undefined. There are several things you can do to mitigate that: 1. Initialize the data in the component Set the selectedData class property to an empty array so … Read more