RVB/RYB correspondance
Testing with an array
by toubia95
HTML
<p class="valeur">Valeur affichée : </p>
CSS
/* js array
http://www.w3schools.com/js/js_obj_array.asp
*/
JavaScript
var degree = -5;
if (degree < 0) {degree = Math.abs(degree);}
if (degree > 3) {degree = degree%3;}
var rybcolors=["zero","un","deux","trois"];
var rgbcolor=rybcolors[degree];
$('.valeur').append(rgbcolor);