SlideShare a Scribd company logo
Introduction to JavaScript for APEX Developers - Module 1: JavaScript Basics
Introduction to JavaScript for APEX Developers
Module 1: JavaScript Basics
2
Why JavaScript?
JavaScript Basics
1
2
3
4
5
Variables and data types
Operators
Conditionals and loops
Objects and functions
3
6 Developer tools
Why JavaScript?
JavaScript Basics
1
4
5
If you're looking for a great APEX
developer, you're really looking for
a full-stack developer.
https://joelkallman.blogspot.com/2017/10/a-great-apex-developer-isa-full-stack.html
“
Joel Kalman, co-creator of APEX
6
Oracle Database
Data Modeling
SQL
PL/SQL
Server-side Client-side
Introduction to JavaScript for APEX Developers - Module 1: JavaScript Basics
Introduction to JavaScript for APEX Developers - Module 1: JavaScript Basics
9
Oracle Database
Data Modeling
SQL
PL/SQL
Server-side Client-side
HTML
CSS
JavaScript
Your goal is not to be the master…
It often takes just a few lines of JavaScript
to deliver functionality not available out-of-the-box
Your goal is not to be the master…
Custom JavaScript code may break
when upgrading APEX. This often
results from small changes to the
HTML generated by APEX and may
require minor adjustments to fix.
You have been warned!
Tips to avoid issues:
§ Be conservative in assumptions about APEX generated HTML
§ Stick to documented APEX APIs
• https://apex.oracle.com/jsapi
§ Avoid deprecated APIs
• Includes 3rd party libraries, such as jQuery
Languages at a glance
PL/SQL
§ Designed to extend SQL
§ 3rd generation language
• Based on Ada
§ Procedural/block structured
JavaScript
§ Designed to program the web
§ 3rd generation language
• Based on Scheme, C++/Java
§ Flexible/based on functions
14
JavaScript Basics
2 Variables and data types
15
Declaring variables in PL/SQL
§ Scope works by blocks
• Nested blocks see outer scope
§ Declaration done in the declaration section
§ Strongly typed: specify name and data type
• Data type will not change
§ Not case sensitive (by default)
16
Declaring variables in JavaScript
§ Scope works by functions
• Outside of functions = global scope
• Nested blocks see outer scope
§ Declaration can be done anywhere
• Best practice is to declare at top of function
§ Use var to declare a variable in a function
• let and const aren’t well supported in IE 11
§ Weakly typed: variables don’t have types
• Values have types
§ Case sensitive (always)
17
Common data types in PL/SQL
§ All SQL types
§ Plus many PL/SQL only types
18
Scalars
NUMBER PLS_INTEGER CHAR
VARCHAR2 BOOLEAN DATE
TIMESTAMP TSWTZ TSWLTZ
Large Objects
CLOB BLOB
Composites
Records Collections
Other
NULL
Common data types in JavaScript
19
Primitive type Object
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures
Undefined Null
String Number Boolean
Object
Array
Date
Function
Common data types in JavaScript
20
Primitive type Object
https://www.youtube.com/watch?v=wPBjd-vb9eI
Undefined Null
String Number Boolean
Date
Function
Uses IEEE 754 math
.1 + .2 = 0.30000000000000004
Object
Array
Two syntaxes for creating new objects
§ Literal
• Simpler than a constructor function
• Supported by all primitives and basic objects
• Date not supported
§ Constructor function
• Uses new keyword with constructor function
• Use when object literal not available
21
JavaScript Basics
3 Operators
22
Common operator types
23
Assignment Arithmetic Comparison Logical
Assignment operators
24
PL/SQL JavaScript
Simple assignment := =
Add and assign +=
Subtract and assign -=
Multiply and assign *=
Divide and assign /=
Modulus and assign %=
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators
Using assignment operators - PL/SQL vs. JavaScript
25
Using assignment operators - PL/SQL vs. JavaScript
26
Arithmetic operators
27
PL/SQL JavaScript
Addition + +
Subtraction - -
Multiplication * *
Division / /
Modulus mod(m, n) %
Increment ++
Decrement --
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
Arithmetic operators
28
PL/SQL JavaScript
Addition + +
Subtraction - -
Multiplication * *
Division / /
Modulus mod(m, n) %
Increment ++
Decrement --
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
+ is also the concatenation operator! 🤪
Using arithmetic operators - PL/SQL vs. JavaScript
29
Using arithmetic operators - PL/SQL vs. JavaScript
30
Comparison operators
31
PL/SQL JavaScript
Equality = ==
Inequality != or <> !=
Strict equality (value and type) ===
Strict inequality (value or type) !==
Greater than > >
Less than < <
Greater than or equal to >= >=
Less than or equal to <= <=
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators
Using comparison operators - PL/SQL vs. JavaScript
32
Using comparison operators - PL/SQL vs. JavaScript
33
Using comparison operators - PL/SQL vs. JavaScript
34 https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/getting-started/ch2.md#equalish
Favor === and !== to avoid
implicit data conversions!
Logical operators
35
PL/SQL JavaScript
And and &&
Or or ||
Not not !
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators
Using logical operators - PL/SQL vs. JavaScript
36
Using logical operators - PL/SQL vs. JavaScript
37
38
Pop quiz!
What is the value of total after running this script?
A B C
13 '112.00' '10.00112.00'
JavaScript Basics
4 Conditionals and loops
39
Conditional logic overview
40
PL/SQL JavaScript
If-then-else Yes Yes
Case Yes No
Switch No Yes
Ternary operator No Yes
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/conditionals
Using if-then-else - PL/SQL vs. JavaScript
41
Using if-then-else - PL/SQL vs. JavaScript
42
Truthy and falsy values in JavaScript
§ There are six falsy values in JavaScript
• false, null, undefined, NaN, 0, and ""
§ Everything else is truthy!
43
Loops overview
44 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration
PL/SQL JavaScript
Loop Yes No
For loop Yes Yes
Cursor for loop Yes No
While loop Yes Yes
Do while loop No Yes
For in loop Yes Yes
For of loop No Yes
Loop labels Yes Yes
Continue Yes Yes
Using for loops - PL/SQL vs. JavaScript
45
Using for loops - PL/SQL vs. JavaScript
46
Using for loops - PL/SQL vs. JavaScript
47
1 based array index
0 based array index
Using for loops - PL/SQL vs. JavaScript
48
Elements
accessed with ()
Elements
accessed with []
JavaScript Basics
5 Objects and functions
49
Using “objects” - PL/SQL vs. JavaScript
50
Using “objects” - PL/SQL vs. JavaScript
51 https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Basics
Functions overview
52
PL/SQL JavaScript
Functions Yes (must return a value) Yes (optionally return a value)
Procedures Yes (does not return a value) No (use a function with no return value)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions
Creating functions in JavaScript
53
Function statement
Creating functions in JavaScript
54
Function statement Function expression
Using functions - PL/SQL vs. JavaScript
55
Using functions - PL/SQL vs. JavaScript
56
Functions are 1st class in JavaScript
§ Functions are a lot like numbers, strings, etc.
§ Can be assigned to variables and passed around as parameters
§ Can be returned from other functions
57
JavaScript objects/functions in browsers
58
Object Description
window THE “global” object. Represents the browser window. (think SYS schema)
document API to the document/web page. We’ll cover this later.
console API for debug output. (think dbms_output)
JSON Object that provides tools for working with JSON, e.g. JSON.parse & JSON.stringify.
setTimeout Function to schedule work for the future (think dbms_scheduler)
setInterval Function to schedule recurring work (think dbms_scheduler)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference#Global_Objects
59
Pop quiz!
Which of the following will not throw an exception?
A B C
JavaScript Basics
60
6 Developer tools
Developer tools for PL/SQL
61
Developer tools for JavaScript
62
https://developers.google.com/web/tools/chrome-devtools
Introduction to JavaScript for APEX Developers - Module 1: JavaScript Basics

More Related Content

PDF
Module 1: JavaScript Basics
PPTX
Dynamic Actions, the Hard Parts
PDF
Introduction to JavaScript for APEX Developers - Module 2: Adding JavaScript ...
PDF
Intro to JavaScript for APEX Developers
PDF
Module 2: Adding JavaScript to APEX Apps
PDF
Module 3: Working with the DOM and jQuery
PDF
Introduction to JavaScript for APEX Developers - Module 3: Working with the D...
PPT
JSF (ADF) Case Studies Presentation
Module 1: JavaScript Basics
Dynamic Actions, the Hard Parts
Introduction to JavaScript for APEX Developers - Module 2: Adding JavaScript ...
Intro to JavaScript for APEX Developers
Module 2: Adding JavaScript to APEX Apps
Module 3: Working with the DOM and jQuery
Introduction to JavaScript for APEX Developers - Module 3: Working with the D...
JSF (ADF) Case Studies Presentation

What's hot (20)

PDF
Introduction to React Native
PPTX
Building Large Scale PHP Web Applications with Laravel 4
PDF
Offline strategies for HTML5 web applications - pfCongres2012
PDF
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
PPTX
Scala Italy 2015 - Hands On ScalaJS
PDF
Engineering the New LinkedIn Profile
PDF
Using Automatic Refactoring to Improve Energy Efficiency of Android Apps
PPTX
Enable Domino Data Access Services (DAS)
PPTX
Debugging PL/SQL from your APEX Applications with Oracle SQL Developer
PDF
React Native - Workshop
PDF
Kiss PageObjects [01-2017]
PPTX
...and thus your forms automagically disappeared
PPT
Wicket Introduction
PDF
Automation Abstractions: Page Objects and Beyond
PPT
Java EE 6 & Spring: A Lover's Quarrel
PDF
[CB19] API-induced SSRF: How Apple Pay Scattered Vulnerabilities Across the W...
PPTX
Oracle SQL Developer version 4.0 New Features Overview
PPTX
Power-Up Your Test Suite with OLE Automation by Joshua Russell
PPTX
Automate Your Data, Free Your Mind by Aaron Swerlein
POT
intoduction to Grails Framework
Introduction to React Native
Building Large Scale PHP Web Applications with Laravel 4
Offline strategies for HTML5 web applications - pfCongres2012
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
Scala Italy 2015 - Hands On ScalaJS
Engineering the New LinkedIn Profile
Using Automatic Refactoring to Improve Energy Efficiency of Android Apps
Enable Domino Data Access Services (DAS)
Debugging PL/SQL from your APEX Applications with Oracle SQL Developer
React Native - Workshop
Kiss PageObjects [01-2017]
...and thus your forms automagically disappeared
Wicket Introduction
Automation Abstractions: Page Objects and Beyond
Java EE 6 & Spring: A Lover's Quarrel
[CB19] API-induced SSRF: How Apple Pay Scattered Vulnerabilities Across the W...
Oracle SQL Developer version 4.0 New Features Overview
Power-Up Your Test Suite with OLE Automation by Joshua Russell
Automate Your Data, Free Your Mind by Aaron Swerlein
intoduction to Grails Framework
Ad

Similar to Introduction to JavaScript for APEX Developers - Module 1: JavaScript Basics (20)

PPTX
Java script basics
PDF
JavaScript Interview Questions Part - 1.pdf
PDF
Efficient Rails Test Driven Development (class 4) by Wolfram Arnold
PPTX
JavaScript_III.pptx
PDF
PHP, the GraphQL ecosystem and GraphQLite
PPTX
How to crack java script certification
PDF
Iwt note(module 2)
PPTX
Interactive Java Support to your tool -- The JShell API and Architecture
PPT
Presentation JavaScript Introduction Data Types Variables Control Structure
PPTX
Unit testing hippo
PPTX
Java script
PPTX
Functional Programming With Lambdas and Streams in JDK8
PDF
Extending Oracle E-Business Suite with Ruby on Rails
PPTX
GraphQL-ify your APIs - Devoxx UK 2021
PPTX
Angular from a Different Angle
PDF
Java Script
PPT
Java Script
PPT
JavaScript ppt for introduction of javascripta
PPTX
ZekeLabs PLSQL slides
PPT
Introduction To Ruby On Rails
Java script basics
JavaScript Interview Questions Part - 1.pdf
Efficient Rails Test Driven Development (class 4) by Wolfram Arnold
JavaScript_III.pptx
PHP, the GraphQL ecosystem and GraphQLite
How to crack java script certification
Iwt note(module 2)
Interactive Java Support to your tool -- The JShell API and Architecture
Presentation JavaScript Introduction Data Types Variables Control Structure
Unit testing hippo
Java script
Functional Programming With Lambdas and Streams in JDK8
Extending Oracle E-Business Suite with Ruby on Rails
GraphQL-ify your APIs - Devoxx UK 2021
Angular from a Different Angle
Java Script
Java Script
JavaScript ppt for introduction of javascripta
ZekeLabs PLSQL slides
Introduction To Ruby On Rails
Ad

Recently uploaded (20)

PDF
Chapter 2 Digital Image Fundamentals.pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Electronic commerce courselecture one. Pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Sensors and Actuators in IoT Systems using pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Transforming Manufacturing operations through Intelligent Integrations
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
Chapter 2 Digital Image Fundamentals.pdf
Big Data Technologies - Introduction.pptx
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
Dropbox Q2 2025 Financial Results & Investor Presentation
NewMind AI Monthly Chronicles - July 2025
Electronic commerce courselecture one. Pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Sensors and Actuators in IoT Systems using pdf
cuic standard and advanced reporting.pdf
Spectral efficient network and resource selection model in 5G networks
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
NewMind AI Weekly Chronicles - August'25 Week I
Transforming Manufacturing operations through Intelligent Integrations
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf

Introduction to JavaScript for APEX Developers - Module 1: JavaScript Basics