Reassign variable with new value based in javascript

Javascript:

if (london) {
{% assign country = 1%}
}else{

{% assign country = 0%}

}

Frontend:

{% if country == 1%}

It works

{% else%}

It didn’t work

{%endif%}

I would like to achieve something above. Basically the value will be based via javascipt and condition is applied in front end based on the value

Hi @AnthonyWeiner ,

You can’t create liquid variable through Javascript, it’s impossible. You can just use {% raw %} and then pass the variable through script text/template.

Or simply use if condition in Javascript to hide the paragraph you want to show.

Hope it helps!