Am currently using below api to set cookie: ```fu...
# javascript
t
Am currently using below api to set cookie:
Copy code
fun setCookie(name: String, value: String, path: String = "/") {
  document.cookie = "$name=$value;path=$path"
}
Below api to get cookie:
Copy code
fun getCookieValue(name: String): String? {
  val currentCookies = document.cookie.split(";")
  for (cookiePair in currentCookies) {
    val cookieKeyValue = cookiePair.split("=")
    if (cookieKeyValue.first().trim() == name.trim()) {
      return cookieKeyValue[1].trim()
    }
  }
  return null
}
Two questions: 1. Is there any better way to do it? 2. How to delete a cookie key value?
Got the solution: https://www.w3schools.com/js/js_cookies.asp reading this helped.