Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
$.getJSON("/api/users") .then(function(users) { // Transform: return just the names return users.map(u => u.name); }) .then(function(names) { // names is now ["Alice", "Bob", ...] console.log("User names:", names); return names.length; }) .then(function(count) { console.log("Total users:", count); });
Result
Open