Results: 1578
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
var person = {
    firstName: "Penelope",
    lastName: "Barrymore",
    fullName: function () {
        ​// Notice  "this"  refers to an object
        console.log(this.firstName + " " + this.lastName);
    ​// We could have also written this:​
        console.log(person.firstName + " " + person.lastName);
    }
}
by Luka Tatarishvili
4 years ago
0
JavaScript
objects
0
To find out if an object has a specific property as one of its own property. var school = {schoolName:"MIT"};


console.log(school.hasOwnProperty ("schoolName"));  // true because schoolName is an own property on the school object


// Prints false because the school object inherited the toString method from Object.prototype, therefore toString is not an own property of the school object.

console.log(school.hasOwnProperty ("toString"));  

by Luka Tatarishvili
4 years ago
0
JavaScript
objects
0
To find out if a property exists on an object we can use in operator:
var school = {schoolName:"MIT"};
console.log("schoolName" in school);  // true because schoolName is an own property on the school object

console.log("schoolType" in school);  // false because  because we did not define a schoolType property on the school object

// Prints true because the school object inherited the toString method from Object.prototype. 
console.log("toString" in school);  // true
by Luka Tatarishvili
4 years ago
0
JavaScript
objects
0
create object property:
var christmasList = {mike:"Book", jason:"sweater" }
then delete some property with delete keyword
delete christmasList.mike;  // deletes the mike property
by Luka Tatarishvili
4 years ago
0
JavaScript
objects
0
Configurable Attribute
: Specifies whether the property can be deleted or changed.
Enumerable
: Specifies whether the property can be returned in a for/in loop.
Writable:
Specifies whether the property can be changed.
by Luka Tatarishvili
4 years ago
0
JavaScript
objects
0
At first we need to create two
datetime
objects using
createFromFormat
static method of
DateTime
built-in class
$first_date = DateTime::createFromFormat('Y-m-d', "2020-12-23");
$second_date = DateTime::createFromFormat('Y-m-d', "2020-12-30");
Using
diff()
method of
DateTime
class we actually calculate differences between the two dates and we get the result in days
$difference_between_the_days = $second_date->diff($first_date)->format("%a");
	
echo $difference_between_the_days;
by Valeri Tandilashvili
4 years ago
0
PHP
datetime
2
$Datetime_object = DateTime::createFromFormat('Y-m-d', "2020-12-23");
by Valeri Tandilashvili
4 years ago
0
PHP
datetime
1
function hello() { alert('Hi there!'); }

setTimeout(hello, 5000)
or
setTimeout( function() { alert('Hi there!'); }, 5000 )
by Luka Tatarishvili
4 years ago
0
JavaScript
array
0
// join array elements into string.

var family = ["mom", "dad", "mike", "jenny"]
var fstr = family.join();

output:
fstr =  "mom,dad,mike,jenny"
by Luka Tatarishvili
4 years ago
0
JavaScript
array
0
// merge array
 var parents = ["mom", "dad"]
  var children = ["mike", "jenny"]
  var family = parents.concat(children);
Result of family variable:
["mom", "dad", "mike", "jenny"]
by Luka Tatarishvili
4 years ago
0
JavaScript
array
0
Results: 1578