Hi @darwin, I think using JS will not be the proper option. Groovy console as @jeevanraj suggest is the way to go. Below you can find simple groovy script that I believe do what you need.
import com.day.cq.wcm.msm.api.LiveRelationshipManager
import org.apache.sling.api.resource.ModifiableValueMap
// array of properties that should be changed
def propertyNames = ["jcr:title"] as String[]
// map of propertyName:newValue
def propertyValues = ["jcr:title":"new value"]
// array of page paths that should be changed
def pagePaths = ["/content/we-retail/us/en/men"] as String[]
def liveRelationshipManager = getService(LiveRelationshipManager.class)
pagePaths?.each { pagePath ->
def pageResource = resourceResolver.getResource(pagePath)
def liveRelationship = liveRelationshipManager.getLiveRelationship(pageResource, true)
liveRelationshipManager.cancelPropertyRelationship(resourceResolver, liveRelationship, propertyNames, true)
def jcrContentResource = resourceResolver.getResource(pageResource?.path + "/jcr:content")
def valueMap = jcrContentResource?.adaptTo(ModifiableValueMap.class)
println "Page has been updated ${pageResource?.path}"
propertyNames?.each { property ->
valueMap.put(property, propertyValues[property])
println "Property has been changed ${property}"
}
resourceResolver.commit()
// activating jcr:content because this is place where page properties are stored and this node has been changed
activate(jcrContentResource?.path)
}