var car = new Object();
car.model = "Honda Fit";
car.year = 2004;
car.color = "Blue";
Now remove property:
delete car.year; // or delete car["year"];
The delete operator deletes both the value of the property and the property itself.
Note: If we use delete on an array, it will create a sparse array
new
:
var car = new Object();
car.model = "Honda Fit";
car.year = 2004;
car.color = "Blue";
2)Using an Object Literal
var car = {model :"Honda Fit", year :"2004", color:Blue};
3)
var car = {};
car.model = "Honda Fit";
car.year = 2004;
car.color = "Blue";
4) Using the Object.create method
var animal1 = Object.create(Animal);
animal1.displayType(); // Output:Invertebrates
5)Using a constructor function
Define the constructor function.
function Car(make, model, year) {
this.make = make;
this.model = model;
this.year = year;
}
then create an object called mycar:
var mycar = new Car('Honda', 'Fit', 2004);
primitive data
type is data that has a primitive value.
JavaScript defines 5 types of primitive data
types:
string
number
boolean
null
undefined
primitive value
is a value that has no properties or methods.string, array, function, date boolean, numbers, regular expressions, and objects
too.
All JavaScript values, except primitives, are objects.<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text" id="btnGroupAddon">@</div>
</div>
<input type="text" class="form-control" placeholder="Input group example" aria-label="Input group example" aria-describedby="btnGroupAddon">
</div>
<div class="btn-group btn-group-lg" role="group" aria-label="Basic example">
<button type="button" class="btn btn-secondary">Left</button>
<button type="button" class="btn btn-secondary">Middle</button>
<button type="button" class="btn btn-secondary">Right</button>
</div>
<div class="btn-group" role="group" aria-label="Basic example">
<button type="button" class="btn btn-secondary">Left</button>
<button type="button" class="btn btn-secondary">Middle</button>
<button type="button" class="btn btn-secondary">Right</button>
</div>
<div class="btn-group btn-group-sm" role="group" aria-label="Basic example">
<button type="button" class="btn btn-secondary">Left</button>
<button type="button" class="btn btn-secondary">Middle</button>
<button type="button" class="btn btn-secondary">Right</button>
</div>
<div class="btn-group" role="group" aria-label="Basic example">
<button type="button" class="btn btn-secondary">Left</button>
<button type="button" class="btn btn-secondary">Middle</button>
<button type="button" class="btn btn-secondary">Right</button>
</div>
$breadcrumb-divider: none;
sass variable.
We can even assign SVG icon using the following syntax$breadcrumb-divider: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4IiBoZWlnaHQ9IjgiPjxwYXRoIGQ9Ik0yLjUgMEwxIDEuNSAzLjUgNCAxIDYuNSAyLjUgOGw0LTQtNC00eiIgZmlsbD0iY3VycmVudENvbG9yIi8+PC9zdmc+);
If we want to remove the separator, we assign none
to the variable$breadcrumb-divider: none;