Skip to content

Instantly share code, notes, and snippets.

@josdem
Last active February 8, 2016 16:46
Show Gist options
  • Save josdem/c190215381374abb08fe to your computer and use it in GitHub Desktop.
Save josdem/c190215381374abb08fe to your computer and use it in GitHub Desktop.
// Calling functions dynamically
var str = 'fisica'
var actions = {
fisica: function() {console.log('Fisica')},
moral: function() {console.log('Moral')}
}
actions[str]()
//Substring example
var clabe = '072180002095154312'
var bankCode = '40072'
if(clabe.substring(0,3) == bankCode.substring(bankCode.length-3, bankCode.length)){
console.log('It is equals')
} else {
console.log('Is not equals due to', clabe.substring(0,3) + " != " + bankCode.substring(bankCode.length-3, bankCode.length))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment