开发者

How can I write object oriented Javascript without using a framework?

开发者 https://www.devze.com 2023-03-29 22:03 出处:网络
Sorry, I am still trying to teach myself Javascript and I was wondering whether someone knew the best way开发者_JS百科 to write object oriented Javascript with classes that will interact well with PHP

Sorry, I am still trying to teach myself Javascript and I was wondering whether someone knew the best way开发者_JS百科 to write object oriented Javascript with classes that will interact well with PHP classes.


Javascript is already object oriented, in regards to classes there are many ways in which to achieve "templates". Since you are new to Javascript have a good read of any material from Douglas Crockford especially his book The Good Parts as he will enlighten you to the the true nature of Javascsript.

This leads me to the second part of your question, as to interacting well with PHP, my advice (from experience) is to have a good clear data serialization/deserialization layer from which you interact, JSON will help you immensely. Don't try and be clever, Javascript is a very different language to PHP. Work with the language not against it.

Happy coding :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号