Subjects
PRICING
COURSES
SIGN IN
Start Free Trial
Narendar T.
Software Consultant
Tutor Satisfaction Guarantee
Visual Basic Programming
TutorMe
Question:

What are the different ways to Declare and Instantiate an object in Visual Basic?

Narendar T.
Answer:

Dim obj as OBJ.CLASS Set obj = New OBJ.CLASS or Set obj = CreateObject (“OBJ.CLASS”)

PHP Programming
TutorMe
Question:

How can we connect to a MySQL database from a PHP script? To be able to connect to a MySQL database, we must use mysql_connect() function as follows:

Narendar T.
Answer:

<!--?php $database = mysql_connect("HOST", "USER_NAME", "PASSWORD"); mysql_select_db("DATABASE_NAME",$database); ?-->

Javascript Programming
TutorMe
Question:

What will the code below output to the console and why? (function(){ var a = b = 3; })(); console.log("a defined? " + (typeof a !== 'undefined')); console.log("b defined? " + (typeof b !== 'undefined'));

Narendar T.
Answer:

Since both a and b are defined within the enclosing scope of the function, and since the line, they are on begins with the var keyword, most JavaScript developers would expect the type of a and type b to both to be undefined in the above example. However, that is not the case. The issue here is that most developers incorrectly understand the statement var a = b = 3; to be shorthand for: var b = 3; var a = b; But in fact, var a = b = 3; is actually shorthand for: b = 3; var a = b; As a result (if you are not using strict mode), the output of the code snippet would be: a defined? false b defined? true But how can b be defined outside of the scope of the enclosing function? Well, since the statement var a = b = 3; is shorthand for the statements b = 3; and var a = b; b ends up being a global variable (since it is not preceded by the var keyword) and is therefore still in scope even outside of the enclosing function. Note that, in strict mode (i.e., with use strict), the statement var a = b = 3; will generate a runtime error of ReferenceError: b is not defined, thereby avoiding any head fakes/bugs that might otherwise result. (Yet another prime example of why you should use strict as a matter of course in your code!)

Send a message explaining your
needs and Narendar will reply soon.
Contact Narendar
Ready now? Request a lesson.
Start Session
FAQs
What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Session" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.