- Node.js 教程
- Node.js - 首頁
- Node.js - 簡介
- Node.js - 環境搭建
- Node.js - 第一個應用程式
- Node.js - REPL 終端
- Node.js - 命令列選項
- Node.js - 包管理器 (NPM)
- Node.js - 回撥函式概念
- Node.js - 上傳檔案
- Node.js - 傳送郵件
- Node.js - 事件
- Node.js - 事件迴圈
- Node.js - 事件發射器
- Node.js - 偵錯程式
- Node.js - 全域性物件
- Node.js - 控制檯
- Node.js - 程序
- Node.js - 應用程式擴充套件
- Node.js - 打包
- Node.js - Express 框架
- Node.js - RESTful API
- Node.js - 緩衝區
- Node.js - 流
- Node.js - 檔案系統
- Node.js MySQL
- Node.js - MySQL 入門
- Node.js - MySQL 建立資料庫
- Node.js - MySQL 建立表
- Node.js - MySQL 插入資料
- Node.js - MySQL 查詢資料
- Node.js - MySQL 條件查詢
- Node.js - MySQL 排序
- Node.js - MySQL 刪除資料
- Node.js - MySQL 更新資料
- Node.js - MySQL 連線查詢
- Node.js MongoDB
- Node.js - MongoDB 入門
- Node.js - MongoDB 建立資料庫
- Node.js - MongoDB 建立集合
- Node.js - MongoDB 插入資料
- Node.js - MongoDB 查詢資料
- Node.js - MongoDB 查詢
- Node.js - MongoDB 排序
- Node.js - MongoDB 刪除資料
- Node.js - MongoDB 更新資料
- Node.js - MongoDB 限制結果
- Node.js - MongoDB 連線查詢
- Node.js 模組
- Node.js - 模組
- Node.js - 內建模組
- Node.js - 實用工具模組
- Node.js - Web 模組
- Node.js 有用資源
- Node.js - 快速指南
- Node.js - 有用資源
- Node.js - 討論
NodeJS - console.dirxml() 方法
Node.js 的 console.dirxml() 方法會在執行時呼叫 console.log() 方法,並將 dirxml() 方法接收到的引數傳遞給它。此方法不會生成 XML 格式。
假設有一個帶有屬性和值的 物件。如果我們將物件名稱傳遞給 console.dirxml() 方法,它將透過傳遞接收到的引數(物件)來呼叫 console.log 方法。因此,它將在輸出中顯示物件的屬性。
語法
以下是 Node.js console.dirxml() 方法的語法:
console.dirxml(data)
引數
data − 此引數接收 JavaScript 物件或元素。
返回值
此方法將返回已傳遞的物件或元素。
示例
Node.js 的 console.dirxml() 方法只接受一個引數。
在下面的示例中,我們建立一個具有可列舉屬性的物件。然後,我們將該物件作為引數傳遞給 node.js 的 console.dirxml() 方法。
var Family = {
Husband : "Jack",
wife : "Rose",
MarrDuration : "25 years",
Kids : 1,
KidName : "Jase",
}
console.dirxml(Family);
輸出
正如我們在輸出中看到的,這裡的 family 是一個物件,我們將其傳遞給 console.dirxml() 方法,然後此方法將透過傳遞接收到的引數來呼叫 console.log() 方法。
{
Husband: 'Jack',
wife: 'Rose',
MarrDuration: '25 years',
Kids: 1,
KidName: 'Jase'
}
示例
Node.js 的 console.dirxml() 方法只接受一個引數。
在這個例子中,我們將一個整數值作為引數傳遞給 node.js 的 console.dirxml() 方法。
var x = 10; var y = 10; var z = x + y; console.dirxml(z);
輸出
正如我們在輸出中看到的,我們將一個整數值傳遞給 console.dirxml() 方法,然後此方法將透過傳遞接收到的引數來呼叫 console.log() 方法。
20
示例
在這個例子中,我們將一個 字串 作為輸入傳遞給 console.dirxml() 方法。
console.dirxml("Tutorialspoint, Simply Easy Learning at your fingertips");
輸出
正如我們在輸出中看到的,作為引數傳遞的輸入 字串 將被列印。
Tutorialspoint, Simply Easy Learning at your fingertips
nodejs_console_module.htm
廣告
