3 added 18 characters in body
source | link

JavaScript (ES6), 46

Using a regexp to find sad emoticons, that are those beginning with >)]} or ending with `<([{c'<([{c. Side note: other regexps here may be shorter but I'm not sure to understand them.

Usual note: test running the snippet on any EcmaScript 6 compliant browser (notably notnot newest Chrome but not MSIE. I tested on Firefox, Safari 9 could go)

Big news It seems arrow functions finally arrived to Chrome land! Rel 45, august 2015

F=s=>/^[\])}>]|[[({<c]$/.test(s)?'sad':'happy'

//Same length
X=s=>/[\])}>].|.[[({<c]/.test(s)?'sad':'happy'

Y=s=>s.match`].|[)}>].|.[[({<c]`?'sad':'happy'
                 
//TEST
out=x=>O.innerHTML+=x+'\n';

sad='>:[ :-( :( :-c :c :-< :< :-[ :[ :{ 8( 8-( ]:< )-: ): >-: >: ]-: ]: }: )8 )-8'.split` `
happy=':-) :) :D :o) :] :3 :c) :> =] 8) =) :} :^) :-D 8-D 8D x-D xD X-D XD =-D =D =-3 =3 B^D (-: (: (o: [: <: [= (8 (= {: (^:'.split` ` 

out('The sad faces')                   
sad.forEach(x=>out(x + ' is ' + F(x)))
out('\nThe happy faces')
happy.forEach(x=>out(x + ' is ' + F(x)))
<pre id=O></pre>

JavaScript (ES6), 46

Using a regexp to find sad emoticons, that are those beginning with >)]} or ending with `<([{c'. Side note: other regexps here may be shorter but I'm not sure to understand them.

Usual note: test running the snippet on any EcmaScript 6 compliant browser (notably not Chrome not MSIE. I tested on Firefox, Safari 9 could go)

Big news It seems arrow functions finally arrived to Chrome land! Rel 45, august 2015

F=s=>/^[\])}>]|[[({<c]$/.test(s)?'sad':'happy'

//Same length
X=s=>/[\])}>].|.[[({<c]/.test(s)?'sad':'happy'

Y=s=>s.match`].|[)}>].|.[[({<c]`?'sad':'happy'
                 
//TEST
out=x=>O.innerHTML+=x+'\n';

sad='>:[ :-( :( :-c :c :-< :< :-[ :[ :{ 8( 8-( ]:< )-: ): >-: >: ]-: ]: }: )8 )-8'.split` `
happy=':-) :) :D :o) :] :3 :c) :> =] 8) =) :} :^) :-D 8-D 8D x-D xD X-D XD =-D =D =-3 =3 B^D (-: (: (o: [: <: [= (8 (= {: (^:'.split` ` 

out('The sad faces')                   
sad.forEach(x=>out(x + ' is ' + F(x)))
out('\nThe happy faces')
happy.forEach(x=>out(x + ' is ' + F(x)))
<pre id=O></pre>

JavaScript (ES6), 46

Using a regexp to find sad emoticons, that are those beginning with >)]} or ending with <([{c. Side note: other regexps here may be shorter but I'm not sure to understand them.

Usual note: test running the snippet on any EcmaScript 6 compliant browser (notably not newest Chrome but not MSIE. I tested on Firefox, Safari 9 could go)

Big news It seems arrow functions finally arrived to Chrome land! Rel 45, august 2015

F=s=>/^[\])}>]|[[({<c]$/.test(s)?'sad':'happy'

//Same length
X=s=>/[\])}>].|.[[({<c]/.test(s)?'sad':'happy'

Y=s=>s.match`].|[)}>].|.[[({<c]`?'sad':'happy'
                 
//TEST
out=x=>O.innerHTML+=x+'\n';

sad='>:[ :-( :( :-c :c :-< :< :-[ :[ :{ 8( 8-( ]:< )-: ): >-: >: ]-: ]: }: )8 )-8'.split` `
happy=':-) :) :D :o) :] :3 :c) :> =] 8) =) :} :^) :-D 8-D 8D x-D xD X-D XD =-D =D =-3 =3 B^D (-: (: (o: [: <: [= (8 (= {: (^:'.split` ` 

out('The sad faces')                   
sad.forEach(x=>out(x + ' is ' + F(x)))
out('\nThe happy faces')
happy.forEach(x=>out(x + ' is ' + F(x)))
<pre id=O></pre>

2 added 125 characters in body
source | link

JavaScript (ES6), 46

Using a regexp to find sad emoticons, that are those beginning with >)]} or ending with `<([{c'. Side note: other regexps here may be shorter but I'm not sure to understand them.

Usual note: test running the snippet on any EcmaScript 6 compliant browser (notably not Chrome not MSIE. I tested on Firefox, Safari 9 could go)

Big news It seems arrow functions finally arrived to Chrome land! Rel 45, august 2015

F=s=>/^[\])}>]|[[({<c]$/.test(s)?'sad':'happy'
 
//Same length
X=s=>/[\])}>].|.[[({<c]/.test(s)?'sad':'happy'

Y=s=>s.match`].|[)}>].|.[[({<c]`?'sad':'happy'
                 
//TEST
out=x=>O.innerHTML+=x+'\n';

sad='>:[ :-( :( :-c :c :-< :< :-[ :[ :{ 8( 8-( ]:< )-: ): >-: >: ]-: ]: }: )8 )-8'.split` `
happy=':-) :) :D :o) :] :3 :c) :> =] 8) =) :} :^) :-D 8-D 8D x-D xD X-D XD =-D =D =-3 =3 B^D (-: (: (o: [: <: [= (8 (= {: (^:'.split` ` 

out('The sad faces')                   
sad.forEach(x=>out(x + ' is ' + F(x)))
out('\nThe happy faces')
happy.forEach(x=>out(x + ' is ' + F(x)))
<pre id=O></pre>

JavaScript (ES6), 46

Using a regexp to find sad emoticons, that are those beginning with >)]} or ending with `<([{c'. Side note: other regexps here may be shorter but I'm not sure to understand them.

Usual note: test running the snippet on any EcmaScript 6 compliant browser (notably not Chrome not MSIE. I tested on Firefox, Safari 9 could go)

F=s=>/^[\])}>]|[[({<c]$/.test(s)?'sad':'happy'
                   
//TEST
out=x=>O.innerHTML+=x+'\n';

sad='>:[ :-( :( :-c :c :-< :< :-[ :[ :{ 8( 8-( ]:< )-: ): >-: >: ]-: ]: }: )8 )-8'.split` `
happy=':-) :) :D :o) :] :3 :c) :> =] 8) =) :} :^) :-D 8-D 8D x-D xD X-D XD =-D =D =-3 =3 B^D (-: (: (o: [: <: [= (8 (= {: (^:'.split` ` 

out('The sad faces')                   
sad.forEach(x=>out(x + ' is ' + F(x)))
out('\nThe happy faces')
happy.forEach(x=>out(x + ' is ' + F(x)))
<pre id=O></pre>

JavaScript (ES6), 46

Using a regexp to find sad emoticons, that are those beginning with >)]} or ending with `<([{c'. Side note: other regexps here may be shorter but I'm not sure to understand them.

Usual note: test running the snippet on any EcmaScript 6 compliant browser (notably not Chrome not MSIE. I tested on Firefox, Safari 9 could go)

Big news It seems arrow functions finally arrived to Chrome land! Rel 45, august 2015

F=s=>/^[\])}>]|[[({<c]$/.test(s)?'sad':'happy'

//Same length
X=s=>/[\])}>].|.[[({<c]/.test(s)?'sad':'happy'

Y=s=>s.match`].|[)}>].|.[[({<c]`?'sad':'happy'
                 
//TEST
out=x=>O.innerHTML+=x+'\n';

sad='>:[ :-( :( :-c :c :-< :< :-[ :[ :{ 8( 8-( ]:< )-: ): >-: >: ]-: ]: }: )8 )-8'.split` `
happy=':-) :) :D :o) :] :3 :c) :> =] 8) =) :} :^) :-D 8-D 8D x-D xD X-D XD =-D =D =-3 =3 B^D (-: (: (o: [: <: [= (8 (= {: (^:'.split` ` 

out('The sad faces')                   
sad.forEach(x=>out(x + ' is ' + F(x)))
out('\nThe happy faces')
happy.forEach(x=>out(x + ' is ' + F(x)))
<pre id=O></pre>

1
source | link

JavaScript (ES6), 46

Using a regexp to find sad emoticons, that are those beginning with >)]} or ending with `<([{c'. Side note: other regexps here may be shorter but I'm not sure to understand them.

Usual note: test running the snippet on any EcmaScript 6 compliant browser (notably not Chrome not MSIE. I tested on Firefox, Safari 9 could go)

F=s=>/^[\])}>]|[[({<c]$/.test(s)?'sad':'happy'
                   
//TEST
out=x=>O.innerHTML+=x+'\n';

sad='>:[ :-( :( :-c :c :-< :< :-[ :[ :{ 8( 8-( ]:< )-: ): >-: >: ]-: ]: }: )8 )-8'.split` `
happy=':-) :) :D :o) :] :3 :c) :> =] 8) =) :} :^) :-D 8-D 8D x-D xD X-D XD =-D =D =-3 =3 B^D (-: (: (o: [: <: [= (8 (= {: (^:'.split` ` 

out('The sad faces')                   
sad.forEach(x=>out(x + ' is ' + F(x)))
out('\nThe happy faces')
happy.forEach(x=>out(x + ' is ' + F(x)))
<pre id=O></pre>