I'm brand new to Javascript.
I'm playing around with some code here and can't get my if to work, but my else works.
The problem is with (solved == true), it's not working. Not sure what I'm doing wrong here.
<script>
solved = true
</script>
<script type="text/javascript">
function solvedTrue(){
var solved = true
console.log("Solved is now " + solved)
}
</script>
<script type="text/javascript">
function solvedFalse(){
var solved = false
console.log("Solved is now " + solved)
}
</script>
<script type="text/javascript">
function checkStatus(){
console.log("Currently it's " + solved)
}
</script>
<script type="text/javascript">
function tester(){
if (solved = true) {
alert('it worked') }
else {
alert('Did not work')
</script>
<button onclick="tester()">If/Else Test</button>
<button onclick="solvedTrue()">True</button>
<button onclick="solvedFalse()">False</button>
<button onclick="checkStatus()">What's the Status?</button>