New article: String equality comparison in JavaScript
The application of object-oriented objects is quite extensive. It has appeared very early in desktop programming, and its applications are relatively mature, such as C, Java, C#, etc. As for Web programming, it appeared much later, so that current Web development is very difficult. Of course, this is also because Web development involves many technologies. In recent years, object-oriented has been gradually introduced in Web development. Many large websites are developed using PHP. The object-oriented aspects of PHP 4 are not yet perfect, but have been improved in PHP 5. .Net is also object-oriented, but its execution efficiency is not as good as PHP.
JavaScript is also used quite a lot in web development, and many commonly used form validations are completed using it. As a scripting language, JavaScript does not have a dedicated IDE development environment or good debugging tools. Its development is quite slow and it has not attracted people's attention. It wasn't until the emergence of Ajax that it was brought to life. It also allows people to truly see the effects of its combination with other technologies.
JavaScript contains object-oriented objects, but it’s just not popular in applications.
Look at a simple example:
Define CTest class // CTest.js
function CTest()
{
this.m_sStr = "";
this.Input = CTest_Input;
this.Output = CTest_Output;
function CTest_Input(str)
{
this.m_sStr = str;
}
function CTest _Output()
{
alert(this.m_sStr);
}
}
How to use
<script></script>Yes It's very similar to C++, but it's much more convenient to use. <script> <BR>var g_CTest = g_CTest = new CTest(); <BR>g_CTest.Input("Hello! Welcome to my Blog!"); <BR>g_CTest.Output(); <BR></script>