Skip to content

Instantly share code, notes, and snippets.

@rvbsanjose
Created March 21, 2014 19:10
Show Gist options
  • Select an option

  • Save rvbsanjose/9693709 to your computer and use it in GitHub Desktop.

Select an option

Save rvbsanjose/9693709 to your computer and use it in GitHub Desktop.
Simple Symbols
function SimpleSymbols(str) {
if ( str.length == 0 || !str.match(/[a-zA-Z]/) )
return false;
for ( var i = 0; i < str.length; i++ ) {
if ( str[i].match(/[a-zA-Z]/) ) {
var v = [str[i-1] == '+', str[i+1] == '+'].every(function (e, idx, ary) {
return ( e == true );
});
if ( v == false )
return false;
}
}
return v;
}
// keep this function call here
// to see how to enter arguments in JavaScript scroll down
SimpleSymbols(readline());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment