Return to Snippet

Revision: 48578
at August 17, 2011 22:28 by Sullan


Updated Code
var x = "True";
var b = getBoolean(x);
alert(b);

function getBoolean(s)
{
	return s.toLowerCase()=='true'?true:false;
}

// Another simple example
var a = 11;
a == 10 ? alert("true") : alert("false");

Revision: 48577
at July 5, 2011 17:25 by Sullan


Initial Code
var x = "True";
var b = getBoolean(x);
alert(b);

function getBoolean(s)
{
	return s.toLowerCase()=='true'?true:false;
}

Initial URL

                                

Initial Description

                                

Initial Title
Single line if else condition

Initial Tags

                                

Initial Language
JavaScript