Interview Questions → JAVASCRIPT → JavaScript Questionnaire II

JavaScript Questionnaire II









<script language="javascript" type="text/javascript">
  function ChangeXValue() {
    var x = 2;
  }
  ChangeXValue();
  alert(x);
</script>	








<script language="javascript" type="text/javascript">
  function ChangeXValue() {
    x = 2;
  }
  ChangeXValue();
  alert(x);
</script>	






  window.opener.location.reload();






function CompareString(string1, string2, ignoreCase) {
  if (ignoreCase != null) {
    if (ignoreCase == true) {
      //  Logic to compare string without matching the case
    }
    else {
      //  Logic to compare string and match the case also
    }
  }
  else {
    //  Logic to compare string without matching the case
  }
}






CompareString("test1", "test1");
CompareString("test1", "test1", true);










var x = "3";
alert(typeof x);
alert(typeof parseInt(x));












var url = "abc.com?ID=add text";
var encodedURL = escape(url);
var decodedURL = unescape(encodedURL);




alert(encodedURL);
alert(decodedURL);










<script type="text/JavaScript">
	var name = "my_name";
	alert(name.toUpperCase());
</script>


















Posted By  -  Karan Gupta


Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250