Login
1
Introduction
1.1. About JavaScript
1.2. HASH files
1.3. JS files in #/API
2
General functions
2.1. if
(criteria)
2.2. else
2.3. function
name, params
2.4. return
value
2.5. break
2.6. continue
2.7. typeof
value
2.8. switch
(value)
2.9. import
filename
2.10. try
statements, catch, finally
3
Directives
3.1. Include directive
(file)
3.2. Master directive
(file)
4
Chapter functions
4.1. Chinit
(name)
4.2. Chstep
(name)
4.3. Chdestep
(name)
4.4. Chpush
(name)
4.5. Chpop
(name)
5
Date and time functions
5.1. DateDiff
(date1, date2)
5.2. Formatting dates
5.3. new Date()
5.4. AddSeconds
(datetime, seconds)
5.5. AddMinutes
(datetime, minutes)
5.6. AddHours
(datetime, hours)
5.7. AddDays
(date, days)
5.8. AddMonths
(datetime, months)
5.9. AddYears
(datetime, years)
6
Filesystem functions
6.1. ExtractBase64Images
(html)
6.2. CreateFolder
(folderPath, folderType, folderData)
6.3. DeleteFile
(filePath)
6.4. DeleteFolder
(folderPath)
6.5. FileExists
(filePath)
6.6. FolderExists
(path)
6.7. GetEmbeddedFile
(path, id)
6.8. GetEmbeddedTextFile
(path, id, encoding)
6.9. Include
(path, template)
6.10. GetEmbeddedFileSize
(path, id)
6.11. GetFiles
(path, searchPattern, depth, mode)
6.12. GetFolder
(path)
6.13. GetFolders
(path, searchPattern, depth)
6.14. GetFile
(filepath, metadata)
6.15. GetJson
(filepath)
6.16. LinkFile
(embeddedId, filename)
6.17. ListFiles
(path, searchPattern, tags, recursive, metaOnly)
6.18. ListFolders
(path, searchPattern, recursive, includeCounters)
6.19. LinkImage
(path, width, height, mode)
6.20. Image scaling
6.21. LoadExcel
(filename, column, row, sheet)
6.22. MoveFile
(filePath, toPath)
6.23. MoveFolder
(folderPath, destinationPath)
6.24. RenameFile
(filePath, newName)
6.25. SaveEmbeddedFile
(filePath, filename, data)
6.26. SaveFile
(filePath, data, schema, ensurePath)
6.27. PatchFile
(filePath, patchData)
6.28. SaveJson
(filePath, data, ensurePath)
6.29. LogJson
(filePath, data)
7
Math functions
7.1. Math calculations
7.2. Math.atan
7.3. Math.random
7.4. Math.cos
7.5. Math.PI
7.6. Math.sin
(value)
7.7. Math.sqrt
(value)
7.8. Math.tan
(angle)
7.9. Math.abs
(value)
7.10. Math.pow
(base, exponent)
7.11. Math.ceil
(value)
7.12. Math.floor
(value)
7.13. Math.round
(value)
8
Array functions
8.1. Array.concat
(list)
8.2. Array.every
(callback)
8.3. Array.filter
(filter)
8.4. Array.find
(filter)
8.5. Array.forEach
(callback)
8.6. Array.groupBy
(key)
8.7. Array.indexOf
(item)
8.8. Array.join
(seperator)
8.9. Array.length
8.10. Array.pop
8.11. Array.push
(item)
8.12. Array.reverse
8.13. Array.shift
8.14. Array.isArray
8.15. Array.slice
(start, end)
8.16. Array.some
(evaluator)
8.17. Array.sort
(sorter)
8.18. Array.splice
(start, deleteCount, item1...N)
9
Network functions
9.1. GetRemoteIp
9.2. DownloadFromUrl
(url)
9.3. DownloadFromUrl64
(url)
9.4. HttpGet
(url, headers)
9.5. HttpPut
(url, data, headers)
9.6. HttpPost
(url, data, headers)
9.7. HttpFormPost
(url, data, headers)
9.8. GetUploadBase64
(filename)
9.9. GetUploads
10
Output functions
10.1. Process
(script, cursor)
10.2. console.assert
(condition, message)
10.3. SetContentDisposition
(type, filename)
10.4. HtmlToXlsx
(filename, html)
10.5. HtmlToPdf
(filename, html, usePrintCss)
10.6. base64
(data)
10.7. SetMime
(mime)
10.8. Write
(text)
10.9. SetResultCode
(code)
10.10. GetHeader
(name)
10.11. SetHeader
(name, value)
10.12. Request
10.13. Format
(value, format)
10.14. Formatting numbers
10.15. HTML.format
(html)
10.16. JSON.format
(json)
10.17. Redirect
(url)
10.18. JSON.parse
(json)
10.19. JSON.stringify
(value)
10.20. console.log
(text)
10.21. SetCulture
(culture)
10.22. TextToHtml
(text)
10.23. Chr
(code, ...)
11
String functions
11.1. Guid
11.2. Guid2
11.3. MD5
(text)
11.4. SHA256
(text)
11.5. Template literal (template strings)
11.6. TextDecode
(bytes, encoding)
11.7. TextEncode
(text, encoding)
11.8. ToHtml
(text, text2, ...)
11.9. EncodeFilename
(filename)
11.10. DecodeFilename
(filename)
11.11. encodeURI
(text)
11.12. encodeURIComponent
(text)
11.13. HtmlAttributeEncode
(text)
11.14. HtmlEncode
(text)
11.15. JsStringEncode obsolete
(text)
11.16. RemoveEmptyLines
(text)
11.17. String.concat
(string1, string2, ...)
11.18. String.includes
(search)
11.19. String.substring
(start, end)
11.20. String.indexOf
(text)
11.21. String.lastIndexOf
(text)
11.22. String.normalize
11.23. String.repeat
(times)
11.24. String.replace
(find, replace)
11.25. String.split
(seperator)
11.26. String.endsWith
(text)
11.27. String.startsWith
(text)
11.28. String.trim
11.29. StripTags
(html)
11.30. UrlEncode
(text)
12
Validation functions
12.1. IsNumber
(value, minValue, maxValue)
12.2. IsString
(value, minLength, maxLength)
12.3. AreEqual
(value1, value2)
12.4. AreNotEqual
(value1, value2)
12.5. IsNull
(value)
12.6. IsNotNull
(value)
12.7. IsName
(value)
12.8. IsEmail
(value)
12.9. Assert
(description, resultCode)
12.10. IsDate
(value)
12.11. IsDateTime
(value)
13
Share functions
13.1. Download
(file, template, preview)
13.2. GetFileShares
(path)
13.3. AddFileShare
(file, user, access, subject, message)
13.4. RemoveFileShare
(file, user)
13.5. SendEmail
(file, template, receiver, subject, message)
13.6. DownloadEmbedded
(file, embeddedId, filename)
13.7. GenerateDocument
(file, template)
13.8. SendForm
(form, subject, sendTo, smtp, subjectPrefix)
13.9. DownloadBytes
(data, filename, preview)
14
Authentication
14.1. WriteJwt
(userinfo)
14.2. DenyAccess
14.3. FlagActivity
14.4. DeleteJwt
14.5. GetProfilePictureUrl
(user)
15
Mail functions
15.1. pop3.pop
(options)
15.2. pop3.delete
(options, identifier)
15.3. pop3.get
(options, identifier)
15.4. pop3.getHeader
(options, identifier)
15.5. smtp.send
(config, message)
15.6. imap.connect
(config)
15.7. imap.getCount
(session, folder)
15.8. imap.delete
(session, message)
15.9. imap.getMessage
(session, index / uid, headersOnly, folder)
15.10. imap.disconnect
(connection)
16
Counter functions
16.1. counters.set
(name, value, counterFile)
16.2. counters.get
(name, counterFile)
16.3. counters.inc
(name, value, counterFile)
Home
JavaScript
Math functions
Math functions
JS functions for Maths.
Math calculations
Example of doing math calculations within JS.
Math.atan
Math.random
Returns a number, decimal between 0 and 1.
Math.cos
Math.PI
Returns the number PI.
Math.sin
(value)
Math.sqrt
(value)
Calculates and returns the square root of a number.
Math.tan
(angle)
Returns the tangent of a number in radians
Math.abs
(value)
Turns any number into a positive number. If positive no change, if negative the value is multiplied by -1.
Math.pow
(base, exponent)
Returns the value of a base raised to a power
Math.ceil
(value)
Rounds a number always upwards direction.
Math.floor
(value)
Rounds a number always downwards direction.
Math.round
(value)
Rounds a number to the closest whole number.