Asked by rwniceing
at 2024-08-26 04:32:06
Point:500 Replies:6 POST_ID:829195USER_ID:12079
Topic:
JavaScript;Miscellaneous Programming;jQuery
I get confused with the terminology, constructor, in javascript , it always show in javascript
document or internet article.
Question-1
For example,
function test() {}
var b= new test()
where test() is function constructor always described in those article What is constructing ?
Question-2
var mesg="hello";
console.log(mesg); //hello
var mess = new String("hello") ;
console.log(mesg) //String{0:"h",1:"e",2:"l",3:"l",4:"o",Length:5}
console.log(mesg.constructor); //function String(){ [ native code ] }
What is mesg constructing from mesg.constructor ? What there is [native code] meaning ?
What is native meaning in javascript( i.e. bulit-in code or function) ?
Question-3.
Could we show all String function code inside instead of [native code], OR it is not allowed on browser ?
Question-4.
Is it exactly same meaning of constructor in javascript as in C++ such using "::"
Please advise
Rwniceing
document or internet article.
Question-1
For example,
function test() {}
var b= new test()
where test() is function constructor always described in those article What is constructing ?
Question-2
var mesg="hello";
console.log(mesg); //hello
var mess = new String("hello") ;
console.log(mesg) //String{0:"h",1:"e",2:"l",3:"l",4:"o",Length:5}
console.log(mesg.constructor); //function String(){ [ native code ] }
What is mesg constructing from mesg.constructor ? What there is [native code] meaning ?
What is native meaning in javascript( i.e. bulit-in code or function) ?
Question-3.
Could we show all String function code inside instead of [native code], OR it is not allowed on browser ?
Question-4.
Is it exactly same meaning of constructor in javascript as in C++ such using "::"
Please advise
Rwniceing