CheckBox get selected / checked as true or false in Javascript and JQuery

Checkbox has an attribute checked which can have two values "checked" or "unchecked" we have to just check it with "checked" value to checked attribute of checkbox.
$('#mycheckbox').is(':checked') ? true : false;
In plain javascript we can do it simply by
var checkbox = document.getElementById("mycheckbox").checked;