Home>Articles>Open Source>Ajax & JavaScript

CoffeeScript in a Nutshell, Part 3: CoffeeScript Functions and Classes

One of CoffeeScript's key strengths is that almost everything is an expression. In addition to learning about this concept in Part 3 of Jeff Friesen's four-part series on CoffeeScript, you explore CoffeeScript's new and improved operators, destructuring assignments, decisions, and loops (including 'for' comprehensions).
Like this article? We recommend

Like this article? We recommend

InPart 2这四部分CoffeeScript系列,我介绍d you to CoffeeScript's basic language features: comments; semicolons and significant whitespace; variables; string interpolation, multiline strings, and block strings; object literals; arrays and ranges; and functions. This article continues the series by focusing on expressions. You candownload the code from this article here.

Almost Everything Is an Expression

CoffeeScript regards almost everything as anexpression—a combination of operands (such as variables, literals, or function calls) and operators. As well as JavaScript expressions, CoffeeScript supports destructuring assignment, decision, and loop expressions.

When CoffeeScript code doesn't represent an expression, the compiler treats it as astatement. When it represents an expression, the compiler often places the code in aclosure, which returns a value (possibly theundefinedvalue) that can be assigned to a variable.

例如,thetry/catch/finallyconstruct can be treated as a statement or as an expression. Consider the following example. Notice the lack of braces (code within atry,catch, orfinallyblock is indented) and the absence of parentheses around thecatchparameter:

试试x = y抓住犯错console.log犯错console.log“Error:\nType: #{err.type}\nArgs: #{err.arguments}\n"+ "Message: #{err.message}\nStackTrace: #{err.stack}\n"

When run, this example results in a reference error becauseyisn't defined. After outputting theerrobject, its properties are examined and also output. The equivalent JavaScript code (slightly modified for readability) appears below:

try { x = y; } catch (_error) { err = _error; console.log(err); console.log(("Error:\nType: " + err.type + "\nArgs: " + err["arguments"] + "\n") + ("Message: " + err.message + "\nStackTrace: " + err.stack + "\n")); }

The compiler inferred that thistry/catch/finallyexample is being used in a statement context and translated it as such. However, this construct can also appear in an expression context, as follows:

console.log try x = y catch err console.log err finally console.log "cleaning up"

When run, this example'scatchblock executes first, outputting[ReferenceError: y is not defined]. Then, thefinallyblock executes, outputtingcleaning up. Finally,undefinedis returned and output. Consider the following equivalent JavaScript code:

console.log((function() { try { return x = y; } catch (_error) { err = _error; return console.log(err); } finally { console.log("cleaning up"); } })());

Because the closure doesn't explicitly return a value,undefinedis returned.

New Operators

CoffeeScript introduces the Pythonesquechained comparison operator, which tests an expression to see whether it falls between a pair of limits. If it falls between the limits, this operator returns true; otherwise, it returns false. Consider the following example:

20 < age < 50

This operator returns true whenage's value is greater than20and less than50. The JavaScript equivalent appears below:

(20 < age && age < 50);

CoffeeScript also introduces the existential operator (?) to check for variable existence. This postfix operator returns true when a variable is defined and not null; otherwise, it returns false. Consider the following example:

console.log PI?

The JavaScript equivalent appears below:

console.log(PI != null);

CoffeeScript provides a handy variant of this operator that can be used instead of||to supply a default value when the variable is undefined or contains null. The following example demonstrates:

周长=π*(直径?10) #乘以πby diameter if defined and not null # otherwise, multiply PI by 10 (the default value)

The JavaScript equivalent (slightly modified for readability) appears below:

circumference = PI * (typeof diameter !== "undefined" && diameter !== null ? diameter : 10);

CoffeeScript offers two more variants of the existential operator:?=and?.. The?=variant provides safer conditional assignment. If a variable (the left operand) is undefined or null, the right operand is assigned to the variable; otherwise, the variable keeps its value:

a = 2 a ?= 3 console.log "a = #{a}" # output: a = 2 b = undefined b ?= 4 console.log "b = #{b}" # output: b = 4

The JavaScript equivalent appears below:

a = 2; if (a == null) { a = 3; } console.log("a = " + a); b = void 0; if (b == null) { b = 4; } console.log("b = " + b);

The?.variant soaks up all references in a properties chain. The expected result is returned when all properties exist; otherwise,undefinedis returned. The following example attempts to invoke a nonexistentgameobject'ssetup()method and then output itstitleproperty value:

console.log game.setup().title

Unsurprisingly, a browser complains aboutgamenot existing and nothing is logged. In contrast, the following example invokessetup()only whengameexists—undefinedis logged to the console:

console.log game?.setup().title

The JavaScript equivalent appears below:

console.log(typeof game !== "undefined" && game !== null ? game.setup().title : void 0);

Improved Operators

CoffeeScript doesn't support JavaScript's==and!=operators. Instead, it substitutes===for==and!==for!=. Consider the following example:

"abc" == "def" # evaluates to false "abc" != "def" # evaluates to true

When you compile this CoffeeScript code into JavaScript, you'll see that"abc" == "def"is converted to"abc" === "def", and that"abc" != "def"is converted to"abc" !== "def". Why these conversions?

JavaScript's==(equality) and!=(inequality) operators perform any needed type conversions before comparing, and these type conversions can cause trouble. For example,'' == '0'evaluates to false,0 == ''evaluates to true, and0 == '0'evaluates to true.

In contrast,===/!===(identity) don't perform type conversions. When types differ,===returns false and!===returns true. Here, identity is faster than equality/inequality and may return a different (but always correct) result.

CoffeeScript provides several aliases for various operators, to promote source code readability. These aliases includeand(&&),or(||),not(!),is(==),isnt(!=),yes(true),no(false),on(true), andoff(false). Here are a few examples:

console.log x < 10 and y > 20 # equivalent to console.log x < 10 && y > 20 console.log x >= 10 or y <= 20 # equivalent to console.log x >= 10 || y <= 20 console.log not true # equivalent to console.log !true console.log age is 65 # equivalent to console.log age == 65 console.log age isnt 65 # equivalent to console.log age != 65 console.log choice is yes # equivalent to console.log choice == true console.log choice isnt no # equivalent to console.log choice != false console.log lightswitch is on # equivalent to console.log lightswitch == true console.log lightswitch isnt off # equivalent to console.log lightswitch != fals

Destructuring Assignments

Adestructuring assignmentis an expression that extracts multiple values from an object literal or array and assigns them to an array of variables. CoffeeScript breaks up and matches both sides against each other, assigning right-side values to left-side variables.

Destructuring assignment is useful for swapping the values in a pair of variables. This capability is demonstrated in the following example:

x = 1 y = 2 console.log "x = #{x} and y = #{y}" # output: x = 1 and y = 2 [x, y] = [y, x] console.log "x = #{x} and y = #{y}" # output: x = 2 and y = 1

The equivalent JavaScript code appears below:

x = 1; y = 2; console.log("x = " + x + " and y = " + y); _ref = [y, x], x = _ref[0], y = _ref[1]; console.log("x = " + x + " and y = " + y);

Destructuring assignment is also useful with functions that return multiple values, as demonstrated below:

circleInfo = (radius) -> [Math.PI*radius*radius, Math.PI*2*radius] [area, circumference] = circleInfo 10 console.log "area = #{area}, circumference = #{circumference}"

ThecircleInfofunction takes a singleradiusargument and returns a two-element array consisting of the area followed by the circumference based on this argument. Destructuring assignment extracts the radius and circumference to separate variables.

The JavaScript equivalent appears below:

circleInfo = function(radius) { return [Math.PI * radius * radius, Math.PI * 2 * radius]; }; _ref1 = circleInfo(10), area = _ref1[0], circumference = _ref1[1]; console.log("area = " + area + ", circumference = " + circumference);

Destructuring assignment is especially useful for extracting an object's deeply nested properties, as follows:

employees = accounts: name: "John Doe" address: [ "200 AnyStreet" "AnyCity" ] {accounts: {name, address: [street, city]}} = employees console.log "name: #{name}, street: #{street}, city: #{city}"

This example outputs the following:

name: John Doe, street: 200 AnyStreet, city: AnyCity

The equivalent JavaScript code (slightly modified for readability) appears below:

employees = { accounts: { name: "John Doe", address: ["200 AnyStreet", "AnyCity"] } }; _ref2 = employees.accounts, name = _ref2.name, (_ref3 = _ref2.address, street = _ref3[0], city = _ref3[1]); console.log("name: " + name + ", street: " + street + ", city: " + city);

Finally, destructuring assignment is useful with splats:

dataline = "230,452,89,92" [numbers...] = dataline.split "," console.log numbers # output: [ '230', '452', '89', '92' ]

This example splitsdatalineinto four values that it assigns to elements of thenumbersarray. The equivalent JavaScript code appears below:

dataline = "230,452,89,92"; _ref4 = dataline.split(","), numbers = 1 <= _ref4.length ? __slice.call(_ref4, 0) : []; console.log(numbers)

Decision Statements and Expressions

CoffeeScript provides several decision constructs that you can use to determine the flow of execution, by evaluating Boolean expressions or choosing one of multiple possibilities.

if,if-else,unless, andunless-else

You can specifyifandif-else在CoffeeScript的方式类似in JavaScript. However, you don't have to surround the Boolean expression with parentheses, and you don't specify braces to delimit blocks of code. Consider the following examples:

numSales = 85 bonus = 0 if numSales > 50 bonus = 100 console.log "you get a bonus" temp = 0 if temp <= 0 console.log "freezing" else console.log "not freezing"

Unsurprisingly, these examples outputyou get a bonusfollowed byfreezing. The JavaScript equivalent appears below:

numSales = 85; bonus = 0; if (numSales > 50) { bonus = 100; console.log("you get a bonus"); } temp = 0; if (temp <= 0) { console.log("freezing"); } else { console.log("not freezing"); }

CoffeeScript providesunlessas a convenient alternative to specifyingif !Boolean expression. Simply substituteunlessforif, which I demonstrate below:

value = 100 unless value < 0 console.log Math.sqrt value age = 65 unless age >= 65 console.log "you aren't old enough to receive a pension" else console.log "you are old enough to receive a pension"

These examples output10followed byyou are old enough to receive a pension. The JavaScript equivalent appears below:

value = 100; if (!(value < 0)) { console.log(Math.sqrt(value)); } age = 65; if (!(age >= 65)) { console.log("you aren't old enough to receive a pension"); } else { console.log("you are old enough to receive a pension"); }

The previous examples demonstratedif,if-else,unless, andunless-elseas if they were statements. However, you'll often use them in expression contexts, as follows:

temp = 40 console.log if temp <= 0 "freezing" value = -400 sqrt = if value < 0 Math.sqrt -value else Math.sqrt value console.log sqrt

For brevity, I've shown onlyifandif-elseexamples. The first example results inundefinedbeing output (becausetemp's value is greater than 0). The second example outputs20.

The following JavaScript code shows you how these examples are implemented:

temp = 40;console.log(临时< = 0 ?“冻结”:签证官id 0); value = -400; sqrt = value < 0 ? Math.sqrt(-value) : Math.sqrt(value); console.log(sqrt);

The compiler uses JavaScript's conditional operator (?:) to implementif,if-else,unless, andunless-elseexpressions. It specifiesvoid 0(which evaluates toundefined) for theelsein each ofifandunless.

if-then,if-then-else,unless-then, andunless-then-else

Suppose you want to specifyif,if-else,unless, orunless-elseon a single line. For example, suppose you would like to specify the following:

temp = 40 console.log if temp <= 0 "freezing" else "boiling"

The compiler complains when it encounters"freezing"adjacent to0. However, it doesn't complain when you place the keywordthenbetween them, as follows:

temp = 40 console.log if temp <= 0 then "freezing" else "boiling"

The JavaScript equivalent appears below:

temp = 40;console.log(临时< = 0 ?"freezing" : "boiling");

You can usethenin the context ofif,if-else,unless, andunless-elseprovided that the code appears on a single line; otherwise, the compiler complains.

Postfixifandunless

CoffeeScript provides a handy postfix form ofifandunlessfor executing code when a Boolean expression is true or false, respectively. The following example uses this form to calculate the square root ofa's value, but only for values that are greater than or equal to 0:

x = 0 a = -200 x = Math.sqrt a if a >= 0 console.log "x = #{x}" # output: x = 0 a = 200 console.log "x = "+Math.sqrt a unless a < 0 # output: x = 14.142135623730951

The equivalent JavaScript code appears below:

x = 0; a = -200; if (a >= 0) { x = Math.sqrt(a); } console.log("x = " + x); a = 200; if (!(a < 0)) { console.log("x = " + Math.sqrt(a)); }

switch-when-else

JavaScript'sswitchstatement is somewhat problematic because of the need to supplybreakstatements to avoid fall-through from onecaseto another. CoffeeScript'sswitch-when-elseequivalent avoids this problem and has the following syntax:

switch condition when clause # ... [else default clause]

Specifyswitchfollowed by an expression that produces an integral value. Follow this with one or morewhenclauses that correspond to JavaScriptcases, and an optionalelsedefault clause.

The following example demonstratesswitch-when-else:

switch 5*Math.random()|0 # |0 converts 5*Math.random() result to integer when 0 then console.log "west" when 1 then console.log "east" when 2 then console.log "north" when 3 then console.log "south" else "unknown"

This example obtains a random integer between 0 and 4 inclusive. It then outputs a direction message based on the integer. The JavaScript equivalent is shown below:

switch (5 * Math.random() | 0) { case 0: console.log("west"); break; case 1: console.log("east"); break; case 2: console.log("north"); break; case 3: console.log("south"); break; default: "unknown"; }

Although you can useswitch-when-elsein a statement context, you'll often use it in an expression context. Here's the expression equivalent of the previous example, which assigns the chosen message to variabledir:

direction = 5*Math.random()|0 dir = switch direction when 0 then "west" when 1 then "east" when 2 then "north" when 3 then "south" else "unknown" console.log "dir = #{dir}"

The equivalent JavaScript code is shown below:

direction = 5 * Math.random() | 0; dir = (function() { switch (direction) { case 0: return "west"; case 1: return "east"; case 2: return "north"; case 3: return "south"; default: return "unknown"; } })(); console.log("dir = " + dir);

Notice that theswitch-when-elseis wrapped in a closure. The compiler uses closures where necessary.

Like Ruby,switch-when-elsecan have multiple comma-separated values for eachwhenclause. Awhenclause is executed when any of these values match. The following example demonstrates this capability:

value = 4 result = switch value when 0, 1 then 100 when 2, 3 then 200 else 300 console.log "result = #{result}" # output: result = 300

The JavaScript equivalent appears below:

value = 4; result = (function() { switch (value) { case 0: case 1: return 100; case 2: case 3: return 200; default: return 300; } })(); console.log("result = " + result);

Loops

CoffeeScript supports repeated execution via several loop constructs:whileand two variants of thewhileconstruct, and theforcomprehension.

whileand Its Variants

You can specifywhilein a manner that's similar to that of JavaScript. However, you don't have to place the Boolean expression between parentheses, and you don't use braces to delimit a block. Consider the following example:

i = 0 while i < 5 console.log i++

The JavaScript equivalent appears below:

i = 0; while (i < 5) { console.log(i++); }

CoffeeScript supports twowhilevariants:untilandloop. Theuntilvariant is equivalent towhile notand theloopvariant is equivalent towhile true. Consider these examples:

i = 0 until i == 5 console.log i++ loop x = Math.random()*5|0 console.log x if x == 3 then break

The second example also demonstrates thebreakstatement for breaking out of a loop. Here's the equivalent JavaScript code:

i = 0; while (i !== 5) { console.log(i++); } while (true) { x = Math.random() * 5 | 0; console.log(x); if (x === 3) { break; } }

You typically usewhileand itsuntilandloop同行在表达式上下文中。例如,the following code fragment uses awhileexpression to return an array of abbreviated month names, which is then output:

monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] index = -1 monthAbbrNames = while ++index != monthNames.length monthNames[index].substring(0, 3) console.log monthAbbrNames

Each iteration evaluates themonthNames[index].substring(0, 3)expression, and its value is appended to themonthAbbrNamesarray. The following equivalent JavaScript code (slightly modified for readability) makes this obvious:

monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; index = -1; monthAbbrNames = (function() { var _results; _results = []; while (++index !== monthNames.length) { _results.push(monthNames[index].substring(0, 3)); } return _results; })(); console.log(monthAbbrNames);

与之前的switch-when-elseexample, a closure is used to wrap the logic for building an array, which is returned and assigned tomonthAbbrNames.

TheforAlternative

Many languages support theforloop, and CoffeeScript is no different. However, it doesn't support traditional C-styleforloops (for example,for (i = 0; i < 10; i++)). Instead, it supports thefor-inconstruct, as demonstrated below:

for fruit in ['apples', 'oranges', 'bananas'] console.log fruit

This loop repeatedly assigns an array element tofruitand outputs this variable's value. The following equivalent JavaScript code shows that this loop is implemented in terms of the traditional C-styleforloop:

_ref = ['apples', 'oranges', 'bananas']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { fruit = _ref[_i]; console.log(fruit); }

You can obtain the current loop index by passing an extra argument, as shown below:

for fruit, i in ['apples', 'oranges', 'bananas'] console.log fruit, i

The equivalent JavaScript code appears below:

_ref1 = ['apples', 'oranges', 'bananas']; for (i = _j = 0, _len1 = _ref1.length; _j < _len1; i = ++_j) { fruit = _ref1[i]; console.log(fruit, i); }

CoffeeScript'sforloop is the basis forlist comprehensions, which are constructs that concisely generate output lists by applying operations to selected members of input lists. The following example provides a simple demonstration:

console.log fruit for fruit in ['apples', 'oranges', 'bananas']

This example produces the same JavaScript code as the earlier example. Each loop iteration assigns an array element tofruitand causesconsole.log()to be invoked, outputting the assigned value.

List comprehensions followset-builder notation, which the following mathematical example demonstrates:

s = { 3*x | x E N, x3> 9 }

This example returns a setsof all numbers3*x, wherexis an element (E) in the set of natural numbers (N), for whichx-cubed is greater than9.

Think of3*xas an output function,xas a variable,Nas an input set, andx3> 9as apredicateeligibl,这决定了这些元素e for set membership. This notation is demonstrated in the following CoffeeScript example:

numArray = (num for num in [10..1] when num > 2) console.log numArray # output: [ 10, 9, 8, 7, 6, 5, 4, 3 ]

The example specifies awhen num > 2predicate, which prevents 2 and 1 from being included in the numbers array. A predicate starts with CoffeeScript'swhenkeyword and is followed by a Boolean expression. Predicates are optional.

The JavaScript equivalent appears below:

numArray = (function() { var _l, _results; _results = []; for (num = _l = 10; _l >= 1; num = --_l) { if (num > 2) { _results.push(num); } } return _results; })(); console.log(numArray);

The parentheses are necessary. Without them, the example wouldn't build an array and assign it tonumArrayat the end of the loop. Instead, each iteration would assign a value tonumArray, overwriting the previous value. You'd end up with the following JavaScript code:

for (num = _l = 10; _l >= 1; num = --_l) { if (num > 2) { numArray = num; } } console.log(numArray);

Sometimes you might want to change the increment when dealing with a range-basedforcomprehension. CoffeeScript supplies the keywordbyfor accomplishing this task. Check out the following example to see how it's used:

numArray = (num for num in [1..10] by 2) console.log numArray # output: [ 1, 3, 5, 7, 9 ]

The equivalent JavaScript code follows:

numArray = (function() { var _m, _results; _results = []; for (num = _m = 1; _m <= 10; num = _m += 2) { _results.push(num); } return _results; })(); console.log(numArray);

Finally, you can use aforcomprehension to iterate over an object literal's property names and values. Use the keywordofto indicate a comprehension over these properties, as demonstrated below:

tokens = else: 100 for: 101 if : 102 next: 103 then: 104 to: 105 console.log "#{name}: #{value}" for name, value of tokens

Thisforcomprehension generates the following output:

else: 100 for: 101 if: 102 next: 103 then: 104 to: 105

The equivalent JavaScript code appears below:

tokens = { "else": 100, "for": 101, "if": 102, next: 103, then: 104, to: 105 }; for (name in tokens) { value = tokens[name]; console.log("" + name + ": " + value); }

The keywordofgenerates a JavaScriptfor-inloop for iterating over object properties. In contrast, the keywordin(for looping over an array or range) generates a JavaScript C-styleforloop.

Conclusion

This article introduced you to CoffeeScript's expression features. After learning that almost everything is an expression, you explored new operators, improved operators, destructuring assignments, decisions, and loops.Part 4ends this series by exploring CoffeeScript classes and a few additional features.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simplyemailinformation@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through ourContact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on theAccount page. If a user no longer desires our service and desires to delete his or her account, please contact us atcustomer-service@informit.comand we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive:www.e-skidka.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information toNevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read ourSupplemental privacy statement for California residentsin conjunction with this Privacy Notice. TheSupplemental privacy statement for California residentsexplains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Pleasecontact usabout this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020