漫画库 {% if comics %}({{ comics|length }}){% endif %}

返回首页
{% with messages = get_flashed_messages(with_categories=true) %} {% for category, message in messages %}
{{ message }}
{% endfor %} {% endwith %} {% if comics %} {% for comic in comics %}

{{ comic.custom_title or comic.title }}

{{ comic.images|length }} 页 {{ comic.created_at }} 原始链接 ↗
{% if comic.comment %}
{{ comic.comment }}
{% endif %}
阅读
{% endfor %} {% else %}

还没有缓存任何漫画

去首页添加
{% endif %}

JavaScript Guide

Intermediate

WebJavaScriptGuide › Objects and properties

Objects and properties

A JavaScript object is a collection of named values. The named values — also called properties — can be of any type: strings, numbers, booleans, dates, functions, arrays, or even other objects.

Object literals

The simplest way to create an object is using an object literal:

const person = { firstName: 'John', lastName: 'Doe', age: 30, hobbies: ['reading', 'coding'], address: { city: 'New York', country: 'USA' }, greet() { return `Hello, I'm ${this.firstName}`; } };

Accessing properties

You can access object properties using dot notation or bracket notation:

// Dot notation console.log(person.firstName); // 'John' // Bracket notation console.log(person['lastName']); // 'Doe' // Dynamic property access const key = 'age'; console.log(person[key]); // 30
Note: Accessing a non-existent property returns undefined. Use the in operator or hasOwnProperty() to check if a property exists.

Object methods

JavaScript provides several static methods for working with objects:

const obj = { a: 1, b: 2, c: 3 }; Object.keys(obj); // ['a', 'b', 'c'] Object.values(obj); // [1, 2, 3] Object.entries(obj); // [['a',1], ['b',2], ['c',3]] // Spread operator const clone = { ...obj }; const merged = { ...obj, d: 4 }; // Destructuring const { a, b, c } = obj;
按 ; 返回