string or string typescript

Solutions on MaxInterview for string or string typescript by the best coders in the world

showing results for - "string or string typescript"
Isabelle
26 Oct 2017
1<script>
2let a = new String("An object !");
3let b = "A literal ! haha";
4console.log(typeof(a));
5console.log(typeof(b));
6</script>
7
8output is shown below.
9object
10string
11
12In general, the string(with a small ‘s’) denotes a primitive whereas 
13String(with an uppercase ‘S’) denotes an object
14
151.Primitive string: The string(with a small ‘s’) indicates a primitive,
16primitives are values that hold no properties. 
172.String literals and a few strings returned from a string function
18call can be classified as a primitive(string).
193. A primitive string can be converted to an
20object by using a wrapper.
214. Object String: The object is an accumulation of different properties.
22An object can call numerous methods corresponding to it.
23
24Github: NathanNoSudo