protected function escapeJS(): string
    {
        $value = $this->validateEncoding();
        $value = htmlspecialchars($value, ENT_COMPAT);

        $value = preg_replace('/&#(x)?0*(?(1)27|39);?/i', '\'', stripslashes($value));
        $value = str_replace("\r", '', $value);

        return str_replace("\n", '\\n', addslashes($value));
    }
protected function escapeJS(): string
    {
        $value = $this->validateEncoding();
        $value = htmlspecialchars($value, ENT_COMPAT);

        $value = preg_replace('/&#(x)?0*(?(1)27|39);?/i', '\'', stripslashes($value));
        $value = str_replace("\r", '', $value);

        return str_replace("\n", '\\n', addslashes($value));
    }
protected function escapeJS ( ) : string { $ value = $ this -> validateEncoding ( ) ; $ value = htmlspecialchars ( $ value , ENT_COMPAT ) ; $ value = preg_replace ( '/&#(x)?0*(?(1)27|39);?/i' , '\'' , stripslashes ( $ value ) ) ; $ value = str_replace ( "\r" , '' , $ value ) ; return str_replace ( "\n" , '\\n' , addslashes ( $ value ) ) ; }
Escape the value to be used within JavaScript.

@since 0.1.0

@return string
Escape the value to be used within JavaScript .