Skip to content

Instantly share code, notes, and snippets.

@kevgathuku
Created October 12, 2014 16:37
Show Gist options
  • Save kevgathuku/edec0fb1bc14a5557149 to your computer and use it in GitHub Desktop.
Save kevgathuku/edec0fb1bc14a5557149 to your computer and use it in GitHub Desktop.
Example of the ternary operator example in JS
//JS Ternary operator example
var protocol = document.location.protocol;
var prot = (protocol == 'http:' || protocol == 'https:') ? 'remote' : 'local'
console.log('You are viewing a ' + prot + ' file via the '+ protocol + ' protocol');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment