当前位置:网站首页>Written examination notes
Written examination notes
2022-07-05 06:34:00 【Silent moon cold moon】
Catalog
Under what circumstances a === a - 1
How to avoid adjacent repetition when randomly selecting array elements ?
How to get integer and decimal parts of a number gracefully ?
How to correctly judge whether a string is a numeric value ?
Preface
Unfamiliar language , Continue to learn , Prepare knowledge points first .
Under what circumstances a === a - 1
1. ±Infinity,Infinity The value of adding and subtracting with any finite number is Infinity
2. A larger number , such as 1e45, To be exact , It's more than Number.MAX_SAFE_INTEGER Number of numbers , It exceeds the integer precision range
3.NaN no way .
How to avoid adjacent repetition when randomly selecting array elements ?
1. Remember the last selected element , To judge whether or not to repeat .
2. After selection , Temporarily delete the selected element , Select again and then add and delete the next element .
3. Before each choice n-1 term , After selection , Match the selected item with n Item exchange . Select before the first time n Elements .
4. Before each choice n-1 term , After selection , Match the selected item with n Item exchange , Discard the first selected element .
How to get integer and decimal parts of a number gracefully ?
Integer
1.parseInt(string, radix)`` This method is a method to convert a string to an integer , It has two parameters , The first parameter represents the string to be converted , If the parameter is not a string , Then convert it to a string . The second parameter is the cardinality, i.e. hexadecimal , The default is 10.
2.Math Method :Math.round It's round ,Math.ceil It's round up ,Math.floor It's rounding down . Positive and negative judgment number , That is floor; Negative namely ceil. Easy way : Math.trunc, There is no need to judge the positive and negative .
3. utilize Bit or “|” Operation to round ( The limited data length is 32).
4. Yes 1 Subtract after taking the mold .
Take decimals
1. Get an integer and subtract .
2. Yes 1 modulus .
How to correctly judge whether a string is a numeric value ?
be used isNumeric To judge the legitimacy of user input .
function isNumeric(obj) {
return !Number.isNaN(parseFloat(obj))
&& Number.isFinite(Number(obj));
}边栏推荐
- [2021]IBRNet: Learning Multi-View Image-Based Rendering Qianqian
- H5 embedded app adapts to dark mode
- Configuration method and configuration file of SolidWorks GB profile library
- 2048 project realization
- ‘mongoexport‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件。
- [QT] QT multithreading development qthread
- 1. Create Oracle database manually
- VLAN experiment
- 求组合数 AcWing 887. 求组合数 III
- Ffmpeg build download (including old version)
猜你喜欢
随机推荐
[2021]GIRAFFE: Representing Scenes as Compositional Generative Neural Feature Fields
C job interview - casting and comparing - C job interview - casting and comparing
Interval problem acwing 906 Interval grouping
[leetcode] day95 effective Sudoku & matrix zeroing
P3265 [jloi2015] equipment purchase
NotImplementedError: Cannot convert a symbolic Tensor (yolo_boxes_0/meshgrid/Size_1:0) to a numpy ar
Bash exercise 17 writing scripts to install the server side of FRP reverse proxy software
区间问题 AcWing 906. 区间分组
2. Addition and management of Oracle data files
Stack acwing 3302 Expression evaluation
MPLS experiment
Using handler in a new thread
Vant Weapp SwipeCell设置多个按钮
TypeScript入门
June 29, 2022 daily
20220213-CTF MISC-a_ good_ Idea (use of stegsolve tool) -2017_ Dating_ in_ Singapore
VLAN experiment
Redis-02.Redis命令
H5内嵌App适配暗黑模式
Redis-01.初识Redis

![[2021]IBRNet: Learning Multi-View Image-Based Rendering Qianqian](/img/f1/e7a8a1a31bc5712d9f32d91305a2b0.jpg)





