Write an empty class Rectangle
that defines a rectangle:
- You must use the
class
notation for defining your class
Write a class Rectangle
that defines a rectangle:
- You must use the
class
notation for defining your class - The constructor must take 2 arguments
w
andh
- Initialize the instance attribute
width
with the value ofw
- Initialize the instance attribute
height
with the value ofh
Write a class Rectangle
that defines a rectangle:
- You must use the
class
notation for defining your class - The constructor must take 2 arguments
w
andh
- Initialize the instance attribute
width
with the value ofw
- Initialize the instance attribute
height
with the value ofh
- If
w
orh
is equal to 0 or not a positive integer, create an empty object
Write a class Rectangle
that defines a rectangle:
- You must use the
class
notation for defining your class - The constructor must take 2 arguments
w
andh
- Initialize the instance attribute
width
with the value ofw
- Initialize the instance attribute
height
with the value ofh
- If
w
orh
is equal to 0 or not a positive integer, create an empty object - Create an instance method called
print()
that prints the rectangle using the characterX
Write a class Rectangle
that defines a rectangle:
- You must use the
class
notation for defining your class - The constructor must take 2 arguments
w
andh
- Initialize the instance attribute
width
with the value ofw
- Initialize the instance attribute
height
with the value ofh
- If
w
orh
is equal to 0 or not a positive integer, create an empty object - Create an instance method called
print()
that prints the rectangle using the characterX
- Create an instance method called
rotate()
that exchanges thewidth
and theheight
of the rectangle - Create an instance method called
double()
that multiples thewidth
and theheight
of the rectangle by 2
Write a class Square
that defines a square and inherits from Rectangle
of 4-rectangle.js
:
- You must use the
class
notation for defining your class andextends
- The constructor must take 1 argument:
size
- The constructor of
Rectangle
must be called (by usingsuper()
)
Write a class Square
that defines a square and inherits from Rectangle
of 4-rectangle.js
:
- You must use the
class
notation for defining your class andextends
- Create an instance method called
charPrint(c)
that prints the rectangle using the characterc
- If
c
isundefined
, use the characterX
- If
Write a function that returns the number of occurrences in a list:
- Prototype:
exports.nbOccurences = function (list, searchElement)
Write a function that returns the reversed version of a list:
- Prototype:
exports.esrever = function (list)
- You are not allow to use the built-in method
reverse
Write a function that prints the number of arguments already printed and the new argument value.
- Prototype:
exports.logMe = function (item)
- Output format:
<number arguments already printed>: <current argument value>
Write a function that converts a number from base 10 to another base passed as argument:
- Prototype:
exports.converter = function (base)
- You are not allowed to import any file
- You are not allowed to declare any new variable (
var
,let
, etc..)
Write a script that imports an array and computes a new array.
- Your script must import
list
from the file100-data.js
- You must use a
map
. - A new list must be created with each value equal to the value of the initial list, multipled by the index in the list
- Print both the initial list and the new list
Write a script that imports a dictionary of occurrences by user id and computes a dictionary of user ids by occurrence.
- Your script must import
dict
from the file101-data.js
- In the new dictionary:
- A key is a number of occurrences
- A value is the list of user ids
- Print the new dictionary at the end
Write a script that concats 2 files.
- The first argument is the file path of the first source file
- The second argument is the file path of the second source file
- The third argument is the file path of the destination