-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
work whit data type #12
base: main
Are you sure you want to change the base?
Conversation
ramin/data_type/data_type.js
Outdated
@@ -0,0 +1,148 @@ | |||
//number | |||
|
|||
let num1 = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should always use const
unless you really need to reassign.
https://stackoverflow.com/questions/41086633/in-javascript-why-should-i-usually-prefer-const-to-let
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay sure
ramin/data_type/data_type.js
Outdated
|
||
//// M A P | ||
|
||
let m1 = new Map(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use better name
let m1 = new Map(); | |
const map = new Map(); |
let s1 = "salam 1"; | ||
let s2 = 'salam 2'; | ||
let s3 = `salam 3 ${5}`; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[High]: We have other types of typing in JavaScript as well.
- bigint
- undefined
- boolean
- function
- symbol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, check this:
typeof null
typeof 2 + "2"
typeof 2 - "2"
typeof 2 * "2"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we have.
but you write string and number i think you want this two type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add theme
return res; | ||
} | ||
|
||
function diffrent(s1,s2){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great!
There is diffrence function built in. Please write this too
ramin/data_type/data_type.js
Outdated
|
||
} | ||
|
||
function intersection(s1,s2){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for intersection
wm.has(obj); | ||
wm.delete(obj); | ||
|
||
/// S E T |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, check this:
- isSubsetOf
- isSupersetOf
ramin/data_type/data_type.js
Outdated
// WEAK SET | ||
///that's like ordinary set but there is some diffrent | ||
// 1 - elements must ba an obj | ||
// 2 - cant't iterate from a weak set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 2 - cant't iterate from a weak set | |
// 2 - cant't iterate from a weak set | |
// 3- WeakSet does not have size property | |
//4- WeakSet does not have clear, keys, values, entries, forEach methods. |
//is exist ? | ||
console.log(m1.has("ahmad")); | ||
|
||
//tree method to iterate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, there is forEach
closes : #7