JavaScript - Data Types and this key word (Part 2)

JavaScript Data types

JavaScript Data types one of the most fundamental characteristics of a programming language is the set of data types it supports. These are the type of values that can be represented and manipulated in a programming language. 

 







JavaScript allows you to work with three primitive data types: 

  •  Numbers, e.g., 123, 120.50 etc. 
  • Strings of text, e.g. "This text string" etc. 
  • Boolean, e.g. true or false. 

JavaScript also defines two trivial data types, null and undefined, each of which defines only a single value. In addition to these primitive data types, JavaScript supports a composite data type known as an object. We will cover objects in detail in a separate chapter.

Note: Java does not make a distinction between integer values and floating-point values. All numbers in JavaScript are represented as floating-point values. JavaScript represents numbers using the 64-bit floating-point format defined by the IEEE 754 standard.

 

JavaScript This Key Word









The JavaScript this keyword refers to the object it belongs to. It has different values depending on where it is used:

  • In a method, this refers to the owner object.
  • Alone, this refers to the global object.
  • In a function, this refers to the global object.
  • In a function, in strict mode, this is undefined.
  • In an event, this refers to the element that received the event.
  • Methods like call (), and apply () can refer this to any object.

this in a Method: In an object method, this refers to the "owner" of the method.

Comments

Popular posts from this blog

SALESFORCE

Machine learning and artificial intelligence

Test Tools