Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ZADANIE 1 ////////////////////////////////////
- var calculator =
- {
- save: function(newN)
- {
- this.n = newN;
- },
- sqrt: function()
- {
- return Math.sqrt(this.n);
- },
- };
- calculator.save(25);
- console.log( calculator.sqrt() );
- ZADANIE 3 /////////////////////////////////////////
- function biggestSumOfTwoElements(arr) {
- if(arr.length === 0){
- return "pusta tablica"
- }else if (arr.length === 1){
- return arr[0]
- }
- let result = 0;
- result+=Math.max(...arr);
- arr.splice(arr.indexOf(Math.max(...arr)));
- result+=Math.max(...arr);
- return result
- }
- console.log(biggestSumOfTwoElements([1,2,3,4]));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement