Costruttore di stringhe JavaScript
Esempio
Ottieni il costruttore di una stringa:
let message = "Hello World!";
let text = message.constructor;
Definizione e utilizzo
La constructor
proprietà restituisce la funzione che ha creato il prototipo String.
Per le stringhe JavaScript constructor
restituisce:
funzione String() { [codice nativo] }
Sintassi
string.constructor
Valore di ritorno
funzione String() { [codice nativo] } |
Supporto browser
constructor
è una funzione ECMAScript1 (ES1).
ES1 (JavaScript 1997) è completamente supportato in tutti i browser:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |