Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9b2bb88

Browse files
Add hasOwnProperty example
1 parent e22016a commit 9b2bb88

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*jslint es6, single, devel */
2+
/*eslint no-console: ["error", { allow: ["log"] }] */
3+
4+
'use strict';
5+
6+
let dog = {
7+
cute: true
8+
};
9+
10+
console.log(dog.hasOwnProperty(`ugly`)); // false
11+
console.log(dog.hasOwnProperty(`cute`)); // true
12+
console.log(dog.hasOwnProperty(`toString`)); // false
13+
console.log(Object.prototype.hasOwnProperty(`toString`)); // true

‎examples/hasOwnProperty/index.html‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>hasOwnProperty Example</title>
6+
<link rel="stylesheet" href="http://code-warrior.github.io/styles/reset.css">
7+
<link rel="stylesheet" href="http://code-warrior.github.io/styles/base.css">
8+
</head>
9+
<body>
10+
<h1><code>hasOwnProperty</code> Example</h1>
11+
<p>Open your console to see this program’s output from the file <a href="hasOwnProperty.js">hasOwnProperty.js</a></p>
12+
<script src="hasOwnProperty.js"></script>
13+
</body>
14+
</html>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /