Answer : Javascript does not provide a default method for the right and left commands like MYSQL.
Like PHP, making the right and left functions in Javascript is the best choice.
Use the following method to get the right and left values of a Javascript string
1 2 3 4 5 6 7 | function right(str, chr) { return str.slice(str.length-chr,str.length); } function left(str, chr) { return str.slice(0, chr - str.length); } |
Example :
1 2 | console.log("right('Seegatesite.com',4) , result : ",right('Seegatesite.com',4)) console.log("left('Seegatesite.com',11) , result : ",left('Seegatesite.com',11)) |
The Result :
Leave a Reply