LDR sensor to control LED CODE not working plz check

I had been trying to control LED using LDR with following code, but it is not working:
(ignore “-” in <-html> i have added them to display the code)
<-html>
<-head>

<-script type=“text/javascript”>
var A0 = “A0”;
var A1 = “A1”;
var A2 = “A2”;
var A3 = “A3”;
var True = “HIGH”
var False = “LOW”
var HIGH = “HIGH”
var LOW = “LOW”
var debug = 0

var api_key = “”;
var d_name = “”;
var base_url = “https://cloud.boltiot.com/remote/

function digitalWrite(pin,val){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200 && debug == 1) {
//document.getElementById(“javascript_response”).innerHTML = “Javascript Response : “+xmlhttp.responseText;
alert(xmlhttp.responseText);
var obj = JSON.parse(xmlhttp.responseText);
if(obj.success==“1”){
alert(obj.value);
}
}
};
xmlhttp.open(“GET”, base_url+api_key+”/digitalWrite?pin=”+pin+"&state="+val+"&deviceName="+d_name,true);
xmlhttp.send();
}

function setKey(key,dev_name){
api_key = key;
d_name = dev_name;
}

function setDebug(bool){
if (bool == true){
debug = 1;
}
else{
debug = 0;
}
}

function Dark(){
if(ldr<500)
digitalWrite(0, ‘HIGH’);
else
digitalWrite(0,‘LOW’);
}

function Light(){
digitalWrite(0,‘LOW’);
}

<-/script>
<-title>DarkLight<-/title>
<-/head>

<-body>
<-center>
<-h2>HELLO<-/h2>
<-br>
<-button onclick=“Dark();”>ON<-/button>
<-button onclick=“Light();”>OFF<-/button>
<-/center>
<-/body>

<-/html>

another try:-
<html>
    <head>
        <title>darkLight2</title>
        <script type="text/javascript" src="https://cloud.boltiot.com/static/js/boltCommands.js"></script>
        <script>
        setKey('{{ApiKey}}','{{Name}}');
        </script>
        <script>
            function Dark(){
                if(light<500)
                digitalWrite(0, 'HIGH');
                else
                digitalWrite(0, 'LOW');
            }
            function Light(){
                digitalWrite(0, 'LOW');
            }
            
        </script>
    </head>
    
    <body>
        <button onclick= "Dark();">SWITCH ON</button>
        <button onclick= "Light();">SWITCH OFF</button>
    </body>
</html>