💡 สวัสดีจ้าเพื่อน ๆ วันนี้แอดจะพาเพื่อน ๆ มารู้จักกับ Operator จาก JavaScript ที่จะช่วยให้เพื่อน ๆ เข้าถึงข้อมูลใน Object ได้ง่ายมากขึ้น !!
.
🌈 และเจ้านี่คือ...Optional chaining (?.) นั่นเองจ้า จะเป็นยังไง มีรายละเอียด และวิธีการใช้งานยังไง ไปติดตามกันได้ในโพสต์นี้เลยจ้า ~~
.
✨ Optional chaining (?.) - เป็นตัวดำเนินการที่ทำให้เราสามารถอ่านค่าใน Object ที่ซ้อนกันหลาย ๆ ชั้นได้ง่ายมากขึ้น เขียนง่าย และทำให้โค้ดสั้นลงนั่นเอง
.
จริง ๆ แล้วมันก็เหมือนเราใช้ เครื่องหมายจุด (.) นั่นแหละ แต่ความพิเศษของมันก็คือถ้าในกรณีไม่มีค่าใน Object หรือ Function มันจะ Return เป็น Undefined แทน Error
.
👨💻 Syntax
.
obj.val?.prop
obj.val?.[expr]
obj.arr?.[index]
obj.func?.(args)
.
📑 วิธีการใช้งาน
.
❤️ ตัวอย่าง 1 : ใช้เข้าถึงข้อมูลใน Object
let customer = {
name: "Mew",
details: {
age: 19,
location: "Ladprao",
city: "bangkok"
}
};
let customerCity = customer.details?.city;
console.log(customerCity);
//output => bangkok
.
❤️ ตัวอย่าง 2 : ใช้กับ Nullish Coalescing
let customer = {
name: "Mew",
details: {
age: 19,
location: "Ladprao",
city: "bangkok"
}
};
const customerName = customer?.name ?? "Unknown customer name";
console.log(customerName); //output => Mew
.
❤️ ตัวอย่าง 3 : ใช้กับ Array
const obj1 = {
arr1:[45,25,14,7,1],
obj2: {
arr2:[15,112,9,10,11]
}
}
console.log(obj1?.obj2?.arr2[1]); // output => 112
console.log(obj1?.arr1[5]); // output => undefined
.
📑 Source : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining
.
borntoDev - 🦖 สร้างการเรียนรู้ที่ดีสำหรับสายไอทีในทุกวัน
#javascript #optionalchaining #BorntoDev
同時也有10000部Youtube影片,追蹤數超過2,910的網紅コバにゃんチャンネル,也在其Youtube影片中提到,...
「javascript location」的推薦目錄:
- 關於javascript location 在 BorntoDev Facebook 的最讚貼文
- 關於javascript location 在 Vietcetera Facebook 的精選貼文
- 關於javascript location 在 コバにゃんチャンネル Youtube 的精選貼文
- 關於javascript location 在 大象中醫 Youtube 的最讚貼文
- 關於javascript location 在 大象中醫 Youtube 的精選貼文
- 關於javascript location 在 JS 筆記- location 認識 - 提姆寫程式 的評價
- 關於javascript location 在 JavaScipt Location 的評價
- 關於javascript location 在 How do I redirect to another webpage? - Stack Overflow 的評價
- 關於javascript location 在 window location in JavaScript - YouTube 的評價
- 關於javascript location 在 Getting geographic locations with JavaScript in iOS webapps 的評價
javascript location 在 Vietcetera Facebook 的精選貼文
𝐉𝐨𝐛 𝐃𝐞𝐬𝐜𝐫𝐢𝐩𝐭𝐢𝐨𝐧:
As a FE Developer, you will be working with Designers to implement UI/UX and support development of products as requested. We are looking for someone who is hard-working, has a strong willingness to learn new tech stack and fluent in English.
Please scroll to the end to see the Application Process.
Probation Period: 2 months
𝐑𝐞𝐪𝐮𝐢𝐫𝐞𝐦𝐞𝐧𝐭𝐬:
- 2+ years of experience with modern front-end development.
- Familiar with Agile development process, esp. Scrum framework
- Proficiency in JavaScript and CSS and an understanding of how web technologies work.
- React: component-based architecture is what you must know to get things done in the right way.
- Familiarity with working with REST API.
- Have experience working with search engine optimization (SEO)
- A Linux or Mac user is a huge plus.
Our tech stacks:
- React & Redux
- Next.js as a framework for server side rendering
𝐀𝐛𝐨𝐮𝐭 𝐲𝐨𝐮:
- Team player
- Quick learner
- Excellent communication & documentation skills
- Excellent time management
- Good English skill is a plus
𝐁𝐞𝐧𝐞𝐟𝐢𝐭𝐬:
- Competitive base salary + 13th month-salary
- Subsidised healthcare
- Dynamic and active work environment
- Catered lunch from Monday to Thursday.
- Opportunity to build a product from the ground up that will reach tens of millions of Vietnamese, other countries in Southeast Asia, and globally
- Access to meet and collaborate with experts and brands; just take a look at the content on Vietcetera to see for yourself!
🕧 Working time: from Monday – Friday, from 9.00 a.m. to 6.00 p.m.
🌐 Work location: Centec Tower, Ground Floor, 72 Nguyen Thi Minh Khai, District 3, Ho Chi Minh City.
𝐀𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧 𝐏𝐫𝐨𝐜𝐞𝐬𝐬: Send your CV, with the subject "[Full-Time] FE Developer" to careers@vietcetera.com
If your CV passed our screening, we will send you 02 technical tests. You must pass these tests to be qualified for our interview round.
Thank you for your interest and we can't wait for you to be part of the team!
javascript location 在 JavaScipt Location 的推薦與評價
The Location object represents the current location (URL) of a document. You can access the Location object by referencing the location property of the window ... ... <看更多>
javascript location 在 JS 筆記- location 認識 - 提姆寫程式 的推薦與評價
JavaScript 原生有處理頁面跳轉方法,因為基本上都是在全域的方式下使用,完整寫法為:. window.location.使用方法 ,但因為是全域物件下使用, ... ... <看更多>