Casting an obeject in javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Casting an obeject in javascript

As I know we can not cast an object in javascript, but is there any other way around it?

22nd Nov 2020, 7:06 AM
Khaled ^^ خالد القريشي‎
Khaled ^^ خالد القريشي‎ - avatar
1 Answer
+ 5
Other way around what? You should provide an example. We can explicitly convert values to a certain type in JavaScript. E.g: var s = "25" var n = Number(s) But this depends on the types involved. Can you share the code where you need to "cast" an object?
23rd Nov 2020, 4:34 AM
Kevin ★