- taking the definition of a newer feature and producing a piece of code that's equivalent to the behavior, but is able to run in older JS environments.
if (!Number.isNaN) {
Number.isNaN = function isNaN(x) { return x !== x; };
}
if (!Number.isNaN) {
Number.isNaN = function isNaN(x) { return x !== x; };
}
// IN ES6, USE A DEFAULT VALUE
function foo(a = 2) {
console.log( a );
}
// PRE ES6 EXPLICITLY CHECK FOR A DEFAULT VALUE AND DEFINE IT
My original questions was: Creating and accessing array of objects in Javascript
ACCESS
let sequence = [1, 2, 3];
function phi(table) {
return (table[3] * table[0] - table[2] * table[1]) /
Math.sqrt((table[2] + table[3]) *
(table[0] + table[1]) *
(table[1] + table[3]) *
(table[0] + table[2]));
}
JSON: JavaScript Object Notation
let string = JSON.stringify({squirrel: false,
events: ["weekend"]});
console.log(string);
// → {"squirrel":false,"events":["weekend"]}
console.log(JSON.parse(string).events);
By: Neal Dreher 2019-07-02
Each time I pull photos from my phone (or camera memory card), I go through a process to pull, transform and store photos, followed by sorting, deleting and importing photos into old Google Picasa 3.9. The last version was released in Oct 2015. With 81,000 photos in Picasa, I fear the day I can no longer find a machine that I can run Picasa on.
Slowly I have been thinking about how I will sort my pictures and store them online. I don't really desire to store all in Google Photos, but it maybe the best free option. Right now, Google Photos doesn't have the options built out that Picasa does.
For example:
This is the prompt I am currently using. (Add to ~/.bashrc file.)
#######################################################################################################################
# BEAUTIFY THE COMMAND PROMPT WITH GIT
#######################################################################################################################
# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`